-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix nested dialog focus trap, improve media table
- Loading branch information
Showing
3 changed files
with
40 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import FocusTrapReact from 'focus-trap-react'; | ||
|
||
/** | ||
* A wrapper for focus-trap-react, which we use to completely remove focus traps | ||
* from the DOM rather than using the library's own internal activation/pausing | ||
* mechanisms, which can manifest bugs when nested. | ||
*/ | ||
const FocusTrap = props => { | ||
const { active, children, focusTrapOptions, className } = props; | ||
return active | ||
? <FocusTrapReact focusTrapOptions={focusTrapOptions} className={className}>{children}</FocusTrapReact> | ||
: <div className={className}>{children}</div> | ||
} | ||
|
||
export default FocusTrap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters