Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
hotfix: focus-visibile trigger false positives on mutated active element
TL;DR for a brief moment focus-visible plugin sets document.activeElement to body(proably due to the blur() event on their codebase). that trigger our code to "think" that the active element was mutated — when hidden/removed focus moves to body. So we though that our tabbed element was deleted initiation that spaghetti of finding next, but since nothing was removed, focus visible set "next" to body, so our modal started from fist focus element again. Result we were always trapped in the same element. Solution is to wrap verification in an empty setTimout, that moves our code to the next queue, and in that place focus-visible has done its thing and active element is back to normal. This reveals the fragility of my focusTrap code. I know that is overengineered, but looking at other dialog/modal implementations it seems to me that either i'm not seeing something obvious, or nobody ecounters edge cases as frequent as me. closes #23. But #22 is desperately need 🆘
- Loading branch information