You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@chaddjohnson I think setting shouldFocusAfterRender={false} will disable the focus trap. If you want it to still gain focus initially after opening, something like onAfterOpen={() => this.contentRef.focus()} might work.
@chaddjohnson I believe that shouldFocusAfterRender={false}does disable the focus trap. But not 100% sure, just what glancing at the code looked like to me!
Anyone? :D @chaddjohnson could you explain to me how you have overcome the obstacle?
I can't see how having an overlay on top of the modal should stop the JS logic from trapping the user inside?
An overlay on top prevents focus from ever entering the dialogue via click events. Keyboard tabbing into the modal may still cause focus to be trapped...I haven’t tested that.
@diasbruno We have a guide modal in our app. It can be viewed while using the app, but if it receives focus it needs to be closed before the user can transfer focus back to the rest of the app using the tab button. This is a major accessibility concern for us. All the other functionality of react-modal suits the use case very well.
Activity
jkillian commentedon Feb 27, 2020
@chaddjohnson I think setting
shouldFocusAfterRender={false}will disable the focus trap. If you want it to still gain focus initially after opening, something likeonAfterOpen={() => this.contentRef.focus()}might work.chaddjohnson commentedon Feb 27, 2020
@jkillian Thank you. I wonder if there also is a way to disable the focus trap to enable interaction with the modal without trapping focus.
jkillian commentedon Feb 27, 2020
@chaddjohnson I believe that
shouldFocusAfterRender={false}does disable the focus trap. But not 100% sure, just what glancing at the code looked like to me!Vanals commentedon Dec 3, 2020
Having the same issue here! Would be really useful if we could! In order to make it flexible for other dialogs types!
I tried
shouldFocusAfterRender={false}but doesn't stop the trapping to work. @jkillianVanals commentedon Dec 14, 2020
Anyone? :D
@chaddjohnson could you explain to me how you have overcome the obstacle?
I can't see how having an overlay on top of the modal should stop the JS logic from trapping the user inside?
Thanks!
chaddjohnson commentedon Dec 14, 2020
An overlay on top prevents focus from ever entering the dialogue via click events. Keyboard tabbing into the modal may still cause focus to be trapped...I haven’t tested that.
bvellacott commentedon May 21, 2021
Unfortunately setting
shouldFocusAfterRender={false}does not disable the focus trap.bvellacott commentedon May 21, 2021
I've created a PR to address this issue: #876
diasbruno commentedon May 28, 2021
Sorry for not give attention to this issue...Can anyone explain why would be interest to let the focus scape the modal?
Once a modal is open, no other action can take place...
bvellacott commentedon May 31, 2021
@diasbruno We have a guide modal in our app. It can be viewed while using the app, but if it receives focus it needs to be closed before the user can transfer focus back to the rest of the app using the tab button. This is a major accessibility concern for us. All the other functionality of react-modal suits the use case very well.
diasbruno commentedon Jun 2, 2021
Please see discussion #881. It'd be nice to have some feedback on this.