Skip to content

Conversation

Webini
Copy link
Contributor

@Webini Webini commented Jul 11, 2025

Description

Sometimes, Firefox returns a Restricted { } object instead of a DOM element from document.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

@Webini Webini changed the title fix firefox bug causing crash when startContainer is Restricted object [DatePicker]fix firefox bug causing crash when startContainer is Restricted object Jul 11, 2025
@Webini Webini changed the title [DatePicker]fix firefox bug causing crash when startContainer is Restricted object [bug][DatePicker]fix firefox bug causing crash when startContainer is Restricted object Jul 11, 2025
@Webini Webini changed the title [bug][DatePicker]fix firefox bug causing crash when startContainer is Restricted object [DatePicker]fix firefox bug causing crash when startContainer is Restricted object Jul 11, 2025
@mui-bot
Copy link

mui-bot commented Jul 11, 2025

Deploy preview: https://deploy-preview-18772--material-ui-x.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) ▼-1B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 🔺+1B(0.00%)
@mui/x-date-pickers 🔺+48B(+0.01%) 🔺+18B(+0.01%)
@mui/x-date-pickers-pro 🔺+48B(+0.01%) 🔺+20B(+0.01%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) ▼-1B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against 1781097

@zannager zannager added the scope: pickers Changes related to the date/time pickers. label Jul 11, 2025
@LukasTy LukasTy requested a review from a team July 16, 2025 07:11
@rita-codes rita-codes added the type: bug It doesn't behave as expected. label Jul 28, 2025
Copy link
Member

@rita-codes rita-codes left a 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! ✨

@Webini Webini force-pushed the firefox-restricted-object-bug branch from 2246022 to 6629f94 Compare July 28, 2025 12:16
@Webini
Copy link
Contributor Author

Webini commented Jul 28, 2025

✔️

Copy link

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.

@github-actions github-actions bot added the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Aug 27, 2025
@flaviendelangle flaviendelangle added type: bug It doesn't behave as expected. and removed type: bug It doesn't behave as expected. labels Aug 27, 2025
@github-actions github-actions bot removed the stale Inactive for 7 days (issues) or 30 days (PRs); closed after 5 or 15 more days if no update. label Aug 28, 2025
@flaviendelangle flaviendelangle enabled auto-merge (squash) August 28, 2025 05:27
@flaviendelangle flaviendelangle merged commit b5026f1 into mui:master Aug 28, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: pickers Changes related to the date/time pickers. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants