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

[stable30] fix: pressing Enter submits guest name input #4009

Merged
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
53 changes: 33 additions & 20 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"
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 @@ -122,14 +129,20 @@ $modal-padding: calc(var(--default-grid-baseline) * 4);
.modal__content {
padding: $modal-padding;

.modal__form {
padding: 15px 0;
h3 {
margin: 0;
display: flex;
align-items: center;
}
}

.modal__buttons {
display: flex;
justify-content: center;
padding: 0 $modal-padding $modal-padding $modal-padding;
p, fieldset {
margin: 10px 0;
}

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