File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4949 </p >
5050 </header >
5151
52+ <!-- Screen-reader-only live region for submission success announcement -->
53+ <div class =" hidden-visually" aria-live =" polite" >
54+ {{ successAnnouncement }}
55+ </div >
56+
5257 <NcEmptyContent
5358 v-if =" loading"
5459 class =" forms-emptycontent"
@@ -326,6 +331,7 @@ export default {
326331 answers: {},
327332 loading: false ,
328333 success: false ,
334+ successAnnouncement: ' ' ,
329335 /** Submit state of the form, true if changes are currently submitted */
330336 submitForm: false ,
331337 showConfirmEmptyModal: false ,
@@ -498,6 +504,22 @@ export default {
498504 },
499505
500506 watch: {
507+ success (newVal ) {
508+ if (newVal) {
509+ // Delay populating the live region to avoid the announcement being
510+ // swallowed by the simultaneous large DOM change (form replaced by
511+ // success view). Screen readers need a moment to process the new DOM
512+ // before a polite live region update registers.
513+ setTimeout (() => {
514+ this .successAnnouncement =
515+ this .form .submissionMessage
516+ || t (' forms' , ' Thank you for completing the form!' )
517+ }, 100 )
518+ } else {
519+ this .successAnnouncement = ' '
520+ }
521+ },
522+
501523 hash () {
502524 // If public view, abort. Should normally not occur.
503525 if (this .publicView ) {
You can’t perform that action at this time.
0 commit comments