Fix focus management issues due to incorrectly discarding modalboxes.
Review Request #13923 — Created June 3, 2024 and submitted
The recent changes to fix modalbox focus management with multiple
modalboxes on screen had a couple of bugs with modalbox instance
management that led to over-aggressive focus control.The code to remove a modalbox from the list was actually doing two
things:
Removing all modalboxes after the modalbox's index, not just the one
we wanted to remove.Taking the discarded modalboxes and setting that as the new array.
This resulted in the latest modalbox (and any after it) being the new
set of modalboxes, and ensuring focus on elements outside of that list
would always be stolen and returned to the now-defunct modalboxes. That
issue manifested in Review Board, where attempting to edit a field after
closing the Review Dialog would fail.We now splice the entry out correctly, and discard the list of removed
modalboxes.
Tested the repro case:
- Click Edit Review
- Click Cancel
- Edit a field.
This worked as expected. I added console logs for the
modalBoxes
array
during this process and verified we had the correct state after closing
modalboxes.I also verified the above with nested modalboxes (Edit Review -> Delete
confirmation dialog), ensuring state was correct.Unit tests pass.
Summary | ID |
---|---|
f1aefc3a7cbd3740bc7fe03ed3ca33af0699cf37 |