Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ This is a list of changes made to the Stardust copy of FocusTrapZone in comparis

### fixes
- Do not focus trigger on outside click @sophieH29 ([#627](https://github.com/stardust-ui/react/pull/627))

- Do not hide aria-live regions from accessibility tree @sophieH29 ([#917](https://github.com/stardust-ui/react/pull/917))
### features
- Add focus trap zone [#239](https://github.com/stardust-ui/react/pull/239)
- Used Stardust utils instead of Fabric utilities:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,19 @@ export class FocusTrapZone extends React.Component<FocusTrapZoneProps, {}> {
)
}

// loop through all body's children, except the last one - which is the popup
for (let index = 0; index < bodyChildren.length - 1; index++) {
const element = bodyChildren[index]

if (element.getAttribute('aria-hidden') !== 'true') {
element.setAttribute('aria-hidden', 'true')
element.setAttribute(HIDDEN_FROM_ACC_TREE, 'true')
for (let index = 0; index < bodyChildren.length; index++) {
const currentChild = bodyChildren[index] as HTMLElement
const isOrHasFocusTrapZone =
currentChild === this._root.current || currentChild.contains(this._root.current)
const isAriaLiveRegion = currentChild.hasAttribute('aria-live')

if (
!isOrHasFocusTrapZone &&
!isAriaLiveRegion &&
currentChild.getAttribute('aria-hidden') !== 'true'
) {
currentChild.setAttribute('aria-hidden', 'true')
currentChild.setAttribute(HIDDEN_FROM_ACC_TREE, 'true')
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/react/test/specs/lib/FocusTrapZone-test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as React from 'react'
import * as ReactTestUtils from 'react-dom/test-utils'
import * as keyboardKey from 'keyboard-key'

import {
FocusTrapZone,
FocusZone,
Expand Down