-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FocusTrap] Fix
disableEnforceFocus
behavior (#38816)
- Loading branch information
Showing
3 changed files
with
113 additions
and
52 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
19 changes: 19 additions & 0 deletions
19
test/e2e/fixtures/FocusTrap/DisableEnforceFocusFocusTrap.tsx
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,19 @@ | ||
import * as React from 'react'; | ||
import { FocusTrap } from '@mui/base/FocusTrap'; | ||
|
||
export default function disableEnforceFocusFocusTrap() { | ||
return ( | ||
<React.Fragment> | ||
<button data-testid="initial-focus" type="button" autoFocus> | ||
initial focus | ||
</button> | ||
<FocusTrap open disableEnforceFocus disableAutoFocus> | ||
<div data-testid="root"> | ||
<button data-testid="inside-trap-focus" type="button"> | ||
inside focusable | ||
</button> | ||
</div> | ||
</FocusTrap> | ||
</React.Fragment> | ||
); | ||
} |
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