theKashey / react-focus-lock

It is a trap! A lock for a Focus. 🔓
MIT License
1.28k stars 67 forks source link

Focus scattering is not happening via shards in the latest release #205

Closed kkyusufk closed 2 years ago

kkyusufk commented 2 years ago

Hi, We have a use case in which we allow users to focus outside a modal to a button (lets call it outsideModalButton) and then let them focus back to the modal. So if a Modal is open and has 3 tab able buttons, the users can expect the focus to move in the following sequence modalButton1 -> modalButton2 -> modalButton3 -> outsideModalButton -> modalButton1 and so on. We achieve this by passing shards, which has the ref to the outsideModalButton. This was working fine up untill v2.8.2 which broke this use case. Posting this to understand if this is actually something broken or if we are doing something wrong. Thanks, And great project BTW. We really appreciate the ease-of-life this provides in development.

theKashey commented 2 years ago

That is not supposed to be broken as I also rely on this functionality as well.

The bad news are that there is a test for shards, and it's passing. So it might take some time to create broken example and fix it. If you can provide a good (and short!) example - that can speed things up.

kkyusufk commented 2 years ago

Hi @theKashey , apologies for the delay but you are right, there was a bug from our side only. Thanks for your help!

theKashey commented 2 years ago

😎 no worries