Skip to content

Commit ebdf8f0

Browse files
ToMESSKabalzss
authored andcommitted
fix(ui-options,ui-utils): subgroup titles in Options are not announced by TalkBack and iOS VoiceOver
Closes: INSTUI-4235
1 parent 46f9e38 commit ebdf8f0

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

packages/ui-options/src/Options/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import type { OptionsSeparatorProps } from './Separator/props'
4848

4949
import type { OptionsProps } from './props'
5050
import { allowedProps, propTypes } from './props'
51+
import { isAndroidOrIOS } from '@instructure/ui-utils'
5152

5253
type ItemChild = React.ComponentElement<OptionsItemProps, Item>
5354
type SeparatorChild = React.ComponentElement<OptionsSeparatorProps, Separator>
@@ -108,7 +109,8 @@ class Options extends Component<OptionsProps> {
108109
<span
109110
id={this._labelId}
110111
role="presentation"
111-
aria-hidden="true"
112+
// because TalkBack and iOS VoiceOver don't announce sub-menu labels, aria-hidden needs to be false to achive that
113+
aria-hidden={isAndroidOrIOS() ? 'false' : 'true'}
112114
css={styles?.label}
113115
>
114116
{callRenderProp(renderLabel)}

packages/ui-utils/src/getBrowser.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,23 @@ const isFirefox = () => {
6363
return getBrowser().name === 'Firefox'
6464
}
6565

66-
export { getBrowser, isSafari, isEdge, isIE, isFirefox, isChromium }
66+
const isAndroidOrIOS = (): boolean => {
67+
const parser = new UAParser()
68+
const result = parser.getResult()
69+
const device = parser.getDevice()
70+
return result.os.name === 'Android' ||
71+
device.model === 'iPhone' ||
72+
device.model === 'iPad'
73+
? true
74+
: false
75+
}
76+
77+
export {
78+
getBrowser,
79+
isSafari,
80+
isEdge,
81+
isIE,
82+
isFirefox,
83+
isChromium,
84+
isAndroidOrIOS
85+
}

0 commit comments

Comments
 (0)