Race condition between deloser creation and focusing
ling1726 opened this issue · comments
ling1726 commented
Repro: https://codesandbox.io/s/priceless-meninsky-wi9rje?file=/example.tsx
- Focus 'Root trigger' button
- Press Enter
- 'Open popover' button should be focused
- Press Enter
- Press Escape
- Focus is on the 'Root trigger' button
The problem here is that once the popover opens, the first focusable element (which is a deloser) is focused before the deloser can be created.
This means that the deloser on the first button can never be added to the deloser history
Lines 173 to 180 in 3c29b31
To follow the happy path and avoid the race condition, simply tab to the next button after 'Open popover' in steap 2
and shift tab back to 'Open popover'. This time the deloser is already created so the process
will add it to deloser history