Focus trap doesn't seem to be working in Modal in React Aria Components #4892
-
Hello, I didn't want to create the issue, because there might be some easily catchable issue in the code I am not able to see. Basically, my modal doesn't trap the focus. I cannot really say whether it's an library issue or my code issue. Modal component: Modal component usage: Reproduction: Thank you for help. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 10 replies
-
From a glance, nothing really jumps out to me from your implementation. Mind logging out what value contain is returning after you open the Modal? I'm expecting it to be true after the Modal renders since it should be called by useDialog |
Beta Was this translation helpful? Give feedback.
Ah I checked your yarn.lock, it could be due to multiple versions of @react-aria/overlay, resulting in multiple versions of the
OverlayContext
. This means the OverlayContext setup by the Modal's Overlay might be a different one that the Dialog within tries to access, hence thenull
value forctx
inuseOverlayFocusContain
. Could you confirm if this might be the case?