react-spectrum
react-spectrum copied to clipboard
Fix no blur called on activeelement removed from dom
Closes // Some browsers do not fire onBlur when the document.activeElement is removed from the dom. // Firefox has had a bug open about it for 13 years https://bugzilla.mozilla.org/show_bug.cgi?id=559561 // A Safari bug has been logged for it as well https://bugs.webkit.org/show_bug.cgi?id=243749
This results in FocusScope losing contain sometimes.
β Pull Request Checklist:
- [ ] Included link to corresponding React Spectrum GitHub Issue.
- [ ] Added/updated unit tests and storybook for this change (for new code or code which already has tests).
- [ ] Filled out test instructions.
- [ ] Updated documentation (if it already exists for this component).
- [ ] Looked at the Accessibility Practices for this feature - Aria Practices
π Test Instructions:
Go to FocusableFirstInScope story in FocusScope stories Tab to the button, hit enter Repeat until just a blank area is left with a focus outline This should work across Chrome/FF/Safari
π§’ Your Project:
Related https://github.com/adobe/react-spectrum/issues/874, #2015
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Build successful! π
Also can you make sure all the browser bugs you linked to in the code get added to the wiki page?
Two other perf ideas:
- we could make tracking element removal opt-in
- for FocusScope, we could track only at the scope level rather than the whole document, and use layouteffect cleanup to detect if the scope itself is removed.
but still might be a lot of mutations to process in cases like Virtualizer scrolling, where weβre adding and removing elements all the time.
Build successful! π
Build successful! π
Too scary right now, closing until we decide we want to tackle this again