Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pressing Enter submits guest name input #3992

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 37 additions & 24 deletions src/components/GuestNamePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
:out-transition="true"
size="small"
:show.sync="show">
<div class="modal__content" data-cy="guestNameModal">
<form class="modal__content"
Copy link

@susnux susnux Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, just migrate this to NcDialog and set is-form prop :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds more reasonable, I will take a look :D

data-cy="guestNameModal"
@submit.prevent.stop="submit">
<h3>
<NcIconSvgWrapper v-if="file.icon !== null"
:inline="true"
Expand All @@ -21,24 +23,25 @@
If you don\'t provide one, the default will be used.`) }}
</p>

<div class="modal__form">
<NcTextField :value="guestName"
<fieldset>
<NcTextField ref="guestNameInput"
:value="guestName"
data-cy="guestNameInput"
:label="t('richdocuments', 'Guest name')"
:placeholder="t('richdocuments', 'Anonymous guest')"
type="text"
@update:value="setGuestName" />
</fieldset>

<div class="modal__buttons">
<NcButton data-cy="guestNameSubmit"
:aria-label="t('richdocuments', 'Submit name')"
type="primary"
native-type="submit">
{{ t('richdocuments', 'Submit name') }}
</NcButton>
</div>
</div>

<div class="modal__buttons">
<NcButton data-cy="guestNameSubmit"
:aria-label="t('richdocuments', 'Submit name')"
type="primary"
@click="submit">
{{ t('richdocuments', 'Submit name') }}
</NcButton>
</div>
</form>
</NcModal>
</template>

Expand Down Expand Up @@ -81,6 +84,10 @@ export default {
},

async mounted() {
this.$nextTick(() => {
this.$refs.guestNameInput.focus()
})

const name = document.getElementById('filename').value
const mimeTypeIcon = async () => {
const url = document.getElementById('mimetypeIcon').value
Expand Down Expand Up @@ -120,16 +127,22 @@ export default {
$modal-padding: calc(var(--default-grid-baseline) * 4);

.modal__content {
padding: $modal-padding;

.modal__form {
padding: 15px 0;
}
}

.modal__buttons {
display: flex;
justify-content: center;
padding: 0 $modal-padding $modal-padding $modal-padding;
padding: $modal-padding;

h3 {
margin: 0;
display: flex;
align-items: center;
}

p, fieldset {
margin: 10px 0;
}

.modal__buttons {
margin-top: $modal-padding;
display: flex;
justify-content: end;
}
}
</style>
Loading