microsoft / tabster

Web Application Keyboard Navigation Tools
https://tabster.io
MIT License
118 stars 36 forks source link

feat: Out of DOM order focusing improvement #302

Closed mshoho closed 1 year ago

mshoho commented 1 year ago

Up to this moment we were trying to find out if the next focusable element is out of DOM order (like when are in a modalizer) after the next element search. This detection is needed to handle corner cases in uncontrolled mode when we need to use default action to move focus outside of the browser window, skipping the out of scope focusables. This after the fact detection was hard to understand and was not covering all corner cases. To improve and simplify the overall handling, we now detect if the element is out of DOM order right during the search. So that we can move focus programmatically when next focusable is out of DOM order. This change will also allow to remove the majority of dummy inputs in the subsequent pull requests.