Skip to content
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
22 changes: 22 additions & 0 deletions src/views/Submit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
</p>
</header>

<!-- Screen-reader-only live region for submission success announcement -->
<div class="hidden-visually" aria-live="polite">
{{ successAnnouncement }}
</div>
Comment thread
pringelmann marked this conversation as resolved.

<NcEmptyContent
v-if="loading"
class="forms-emptycontent"
Expand Down Expand Up @@ -323,6 +328,7 @@ export default {
answers: {},
loading: false,
success: false,
successAnnouncement: '',
/** Submit state of the form, true if changes are currently submitted */
submitForm: false,
showConfirmEmptyModal: false,
Expand Down Expand Up @@ -495,6 +501,22 @@ export default {
},

watch: {
success(newVal) {
if (newVal) {
// Delay populating the live region to avoid the announcement being
// swallowed by the simultaneous large DOM change (form replaced by
// success view). Screen readers need a moment to process the new DOM
// before a polite live region update registers.
setTimeout(() => {
this.successAnnouncement =
this.form.submissionMessage
|| t('forms', 'Thank you for completing the form!')
}, 100)
} else {
this.successAnnouncement = ''
}
},

hash() {
// If public view, abort. Should normally not occur.
if (this.publicView) {
Expand Down
Loading