Skip to content

Commit 994f158

Browse files
committed
fix(ui-utils,ui-drilldown): make NDVA read options in Drilldown.Group correctly in Firefox
INSTUI-4330
1 parent 638ffbe commit 994f158

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

packages/ui-drilldown/src/Drilldown/DrilldownGroup/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { optionsThemeGenerator } from '@instructure/ui-options'
2929

3030
import { propTypes, allowedProps } from './props'
3131
import type { DrilldownGroupProps } from './props'
32+
import { isMac, isFirefox } from '@instructure/ui-utils'
3233

3334
/**
3435
---
@@ -48,7 +49,9 @@ class DrilldownGroup extends Component<DrilldownGroupProps> {
4849
static defaultProps = {
4950
disabled: false,
5051
withoutSeparators: false,
51-
role: 'group'
52+
// Firefox with NVDA does not read Drilldown.Group with role="group" correctly
53+
// but setting role="menu" on all other platforms results in Drilldown.Group label not being read
54+
role: !isMac() && isFirefox() ? 'menu' : 'group'
5255
}
5356

5457
render() {

packages/ui-utils/src/getBrowser.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,19 @@ const isAndroidOrIOS = (): boolean => {
7474
: false
7575
}
7676

77+
const isMac = (): boolean => {
78+
const parser = new UAParser()
79+
const result = parser.getResult()
80+
return result.os.name === 'Mac OS'
81+
}
82+
7783
export {
7884
getBrowser,
7985
isSafari,
8086
isEdge,
8187
isIE,
8288
isFirefox,
8389
isChromium,
84-
isAndroidOrIOS
90+
isAndroidOrIOS,
91+
isMac
8592
}

packages/ui-utils/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ export {
4444
isIE,
4545
isFirefox,
4646
isChromium,
47-
isAndroidOrIOS
47+
isAndroidOrIOS,
48+
isMac
4849
} from './getBrowser'

0 commit comments

Comments
 (0)