We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 65eae8d commit 0f4c023Copy full SHA for 0f4c023
packages/react/src/slider/root/useSliderRoot.ts
@@ -72,12 +72,14 @@ export function focusThumb(
72
return;
73
}
74
75
- const doc = ownerDocument(sliderRef.current);
+ const activeEl = activeElement(ownerDocument(sliderRef.current));
76
77
if (
78
- !sliderRef.current.contains(doc.activeElement) ||
79
- Number(doc?.activeElement?.getAttribute(SliderThumbDataAttributes.index)) !== thumbIndex
+ activeEl == null ||
+ !sliderRef.current.contains(activeEl) ||
80
+ Number(activeEl.getAttribute(SliderThumbDataAttributes.index)) !== thumbIndex
81
) {
82
+ // TODO: possibly simplify with thumbRefs as it already exists
83
(
84
sliderRef.current.querySelector(
85
`[type="range"][${SliderThumbDataAttributes.index}="${thumbIndex}"]`,
0 commit comments