+1
-1
src/useModalFocus.ts
+1
-1
src/useModalFocus.ts
···
34
34
let selection: RestoreSelection | null = null;
35
35
if (
36
36
!document.activeElement ||
37
-
!ref.current.contains(document.activeElement)
37
+
!contains(ref.current, document.activeElement)
38
38
) {
39
39
const newTarget = getAutofocusTarget(ref.current);
40
40
selection = snapshotSelection(ref.current);
+3
-5
src/usePriority.ts
+3
-5
src/usePriority.ts
···
23
23
ref: Ref<T>,
24
24
disabled?: boolean
25
25
): boolean {
26
-
function computeHasPriority(): boolean {
26
+
const isDisabled = !!disabled;
27
+
const [hasPriority, setHasPriority] = useState(() => {
27
28
if (!ref.current) return false;
28
29
const tempStack = priorityStack.concat(ref.current).sort(sortByHierarchy);
29
30
return tempStack[0] === ref.current;
30
-
}
31
-
32
-
const isDisabled = !!disabled;
33
-
const [hasPriority, setHasPriority] = useState(computeHasPriority);
31
+
});
34
32
35
33
useLayoutEffect(() => {
36
34
if (!ref.current || isDisabled) return;