-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[DatePicker]fix firefox bug causing crash when startContainer is Restricted object #18772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DatePicker]fix firefox bug causing crash when startContainer is Restricted object #18772
Conversation
Deploy preview: https://deploy-preview-18772--material-ui-x.netlify.app/ Bundle size report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix makes a lot of sense, thanks for catching and addressing it! 🥇
Would you mind adding a small inline comment above the check to explain why it's needed? Something like: "Firefox can return a Restricted object here"
That would help future readers understand why this check is necessary.
Appreciate your work on this! ✨
2246022
to
6629f94
Compare
✔️ |
This pull request has been inactive for 30 days. Please remove the stale label or leave a comment to keep it open. Otherwise, it will be closed in 15 days. |
Description
Sometimes, Firefox returns a
Restricted { }
object instead of a DOM element fromdocument.getSelection().getRangeAt(0).startContainer
.I don't know why or when Firefox does this, but I’ve created a CodeSandbox example where the issue can be reproduced by repeatedly clicking the next/previous month buttons, then clicking outside the date picker popper.
It seems that having the input element present in the DOM is required to reproduce this issue.
Tested on Firefox: 128.12.0esr (64-bit)
demo.mp4