Skip to content

Commit 53413af

Browse files
teemuandersenTeemu AndersènsnowystingerreidbarberLFDanLu
authored
Fix useDateSegment null ref error #6988 (#6989)
Co-authored-by: Teemu Andersèn <[email protected]> Co-authored-by: Robert Snow <[email protected]> Co-authored-by: Reid Barber <[email protected]> Co-authored-by: Daniel Lu <[email protected]>
1 parent b2e8ee6 commit 53413af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/@react-aria/datepicker/src/useDateSegment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export function useDateSegment(segment: DateSegment, state: DateFieldState, ref:
275275
// Otherwise, when tapping on a segment in Android Chrome and then entering text,
276276
// composition events will be fired that break the DOM structure and crash the page.
277277
let selection = window.getSelection();
278-
if (ref.current.contains(selection.anchorNode)) {
278+
if (ref.current && ref.current.contains(selection.anchorNode)) {
279279
selection.collapse(ref.current);
280280
}
281281
});

0 commit comments

Comments
 (0)