File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' focus-trap-react ' : patch
3+ ---
4+
5+ Use preventScroll option on deactivation
Original file line number Diff line number Diff line change @@ -97,7 +97,8 @@ class FocusTrap extends React.Component {
9797 }
9898
9999 deactivateTrap ( ) {
100- const { checkCanReturnFocus } = this . tailoredFocusTrapOptions ;
100+ const { checkCanReturnFocus, preventScroll = false } =
101+ this . tailoredFocusTrapOptions ;
101102
102103 if ( this . focusTrap ) {
103104 // NOTE: we never let the trap return the focus since we do that ourselves
@@ -111,7 +112,9 @@ class FocusTrap extends React.Component {
111112
112113 if ( canReturnFocus ) {
113114 /** Returns focus to the element that had focus when the trap was activated. */
114- returnFocusNode . focus ( ) ;
115+ returnFocusNode . focus ( {
116+ preventScroll,
117+ } ) ;
115118 }
116119
117120 if ( this . onPostDeactivate ) {
You can’t perform that action at this time.
0 commit comments