Skip to content

Commit 7058638

Browse files
committed
Consistent variable naming
1 parent 047290f commit 7058638

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

client/components/common/Tabs/Tabs.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const Tabs = ({ tabs, basePath }) => {
77
const location = useLocation();
88
const navigate = useNavigate();
99
const tabRefs = useRef([]);
10-
const focusTargetRef = useRef(null);
10+
const focusRef = useRef(null);
1111

1212
const getTabIndexFromPath = () => {
1313
if (!basePath) return 0;
@@ -28,7 +28,7 @@ const Tabs = ({ tabs, basePath }) => {
2828
}, [tabs]);
2929

3030
useEffect(() => {
31-
const targetIndex = focusTargetRef.current;
31+
const targetIndex = focusRef.current;
3232
if (
3333
targetIndex !== null &&
3434
targetIndex === selectedTab &&
@@ -39,7 +39,7 @@ const Tabs = ({ tabs, basePath }) => {
3939
if (tabRefs.current[targetIndex]) {
4040
tabRefs.current[targetIndex].focus();
4141
}
42-
focusTargetRef.current = null;
42+
focusRef.current = null;
4343
}, 0);
4444
}
4545
}, [selectedTab, location.pathname]);
@@ -63,7 +63,7 @@ const Tabs = ({ tabs, basePath }) => {
6363
const pathIndex = getTabIndexFromPath();
6464
// Don't update selectedTab if we're in the middle of a programmatic nav
6565
// (indicated by focusTargetRef being set)
66-
if (pathIndex !== selectedTab && focusTargetRef.current === null) {
66+
if (pathIndex !== selectedTab && focusRef.current === null) {
6767
setSelectedTab(pathIndex);
6868
}
6969
}, [location.pathname, tabs, basePath, selectedTab, navigate]);
@@ -107,7 +107,7 @@ const Tabs = ({ tabs, basePath }) => {
107107
}
108108

109109
event.preventDefault();
110-
focusTargetRef.current = newIndex;
110+
focusRef.current = newIndex;
111111
updateSelectedTab(newIndex);
112112
};
113113

0 commit comments

Comments
 (0)