fix(web): [OCISDEV-1590] announce repeated status messages
Orca skips a live region insertion whose text equals the previously queued one, and clearing the region in between doesn't reset that. Append a trailing no-break space to every other announcement so consecutive messages never share the exact same text. Signed-off-by: Matteo <matteo.sonnenholzner@kiteworks.com>
This commit is contained in:
2 files changed
+21
-1
No files matched your search
@@ -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
|
||||
@@ -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<Record<Politeness, string>>({ polite: '', assertive: '' })
|
||||
const pending: Record<Politeness, string[]> = { polite: [], assertive: [] }
|
||||
const timers: Partial<Record<Politeness, ReturnType<typeof setTimeout>>> = {}
|
||||
// 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)
|
||||
|
||||
Reference in new issue
Block a user