Skip to content

Commit

Permalink
Merge pull request #4008 from nextcloud/backport/guest-name-dialog-pr…
Browse files Browse the repository at this point in the history
…ess-enter/stable28

[stable28] fix: pressing `Enter` submits guest name input
  • Loading branch information
juliusknorr authored Sep 10, 2024
2 parents f7a6d6a + 3af561d commit a29a643
Showing 1 changed file with 28 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/components/GuestNamePicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,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 @@ -17,24 +19,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 @@ -77,6 +80,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 @@ -119,19 +126,19 @@ $modal-padding: calc(var(--default-grid-baseline) * 4);
padding: $modal-padding;
h3 {
margin: 0;
display: flex;
align-items: center;
font-size: 1.3em;
}
.modal__form {
padding: 15px 0;
p, fieldset {
margin: 10px 0;
}
}
.modal__buttons {
display: flex;
justify-content: center;
padding: 0 $modal-padding $modal-padding $modal-padding;
.modal__buttons {
margin-top: $modal-padding;
display: flex;
justify-content: end;
}
}
</style>

0 comments on commit a29a643

Please sign in to comment.