diff --git a/changelog/unreleased/bugfix-announce-repeated-status-messages.md b/changelog/unreleased/bugfix-announce-repeated-status-messages.md new file mode 100644 index 00000000000..e42586955dc --- /dev/null +++ b/changelog/unreleased/bugfix-announce-repeated-status-messages.md @@ -0,0 +1,11 @@ +Bugfix: Announce repeated status messages + +Repeating an action that shows the same status message, such as copying a +permanent link several times in a row, was only read out by the Orca screen +reader the first time. Orca skips a message whose text matches the previous +one, even when the announcement area was cleared in between. + +Consecutive status messages now always differ by an inaudible trailing space, +so every repeated message is announced. + +https://github.com/owncloud/ocis/pull/13268 diff --git a/web/packages/web-runtime/src/components/MessageBar.vue b/web/packages/web-runtime/src/components/MessageBar.vue index b4aca4bc742..0d0e00e7ecf 100644 --- a/web/packages/web-runtime/src/components/MessageBar.vue +++ b/web/packages/web-runtime/src/components/MessageBar.vue @@ -30,6 +30,11 @@ type Politeness = 'polite' | 'assertive' // NVDA/JAWS cancel the pending live region update const ANNOUNCE_DELAY_MS = 150 +// Orca drops a live region insertion whose text equals the previously queued one, and +// emptying the region in between doesn't reset that. A trailing no-break space on every +// other announcement keeps consecutive texts distinct; it is stripped before speaking. +const DISTINCT_SUFFIX = '\u00a0' + export default defineComponent({ name: 'MessageBar', setup() { @@ -46,6 +51,8 @@ export default defineComponent({ const announcements = reactive>({ polite: '', assertive: '' }) const pending: Record = { polite: [], assertive: [] } const timers: Partial>> = {} + // shared across both regions, Orca tracks the last queued live region text globally + let appendSuffix = false const announce = (politeness: Politeness, text: string) => { pending[politeness].push(text) @@ -55,7 +62,9 @@ export default defineComponent({ // emptying first makes a repeated identical message a real content change announcements[politeness] = '' timers[politeness] = setTimeout(() => { - announcements[politeness] = pending[politeness].join(' ') + const text = pending[politeness].join(' ') + announcements[politeness] = appendSuffix ? text + DISTINCT_SUFFIX : text + appendSuffix = !appendSuffix pending[politeness] = [] timers[politeness] = undefined }, ANNOUNCE_DELAY_MS)