Skip to content

Commit b5026f1

Browse files
[DatePicker]fix firefox bug causing crash when startContainer is Restricted object (#18772)
Co-authored-by: Flavien DELANGLE <[email protected]>
1 parent e83c26a commit b5026f1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/x-date-pickers/src/internals/hooks/useField/syncSelectionToDOM.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export function syncSelectionToDOM<TValue extends PickerValidValue>(
3030
// If the selection contains an element inside the field, we reset it.
3131
if (
3232
selection.rangeCount > 0 &&
33+
// Firefox can return a Restricted object here
34+
selection.getRangeAt(0).startContainer instanceof Node &&
3335
domGetters.getRoot().contains(selection.getRangeAt(0).startContainer)
3436
) {
3537
selection.removeAllRanges();

0 commit comments

Comments
 (0)