[SHOPTIME-3518] Category / GNB 2뎁스 맨 아래의 카테고리로 이동할 경우 스크롤 오류

1. TabLayout.jsx
2. TabItemSub.jsx
- 원인: scrollTop 동작 조건 오류
- 대책: scrollTop 동작 조건 수정
This commit is contained in:
younghoon100.park
2024-10-31 19:16:03 +09:00
parent 5d2b153ec2
commit 5169a378db
2 changed files with 15 additions and 12 deletions

View File

@@ -28,19 +28,13 @@ const TabItemBase = ({
setLastFocusId,
setSelectedTitle,
setSelectedSubItemId,
setSelectedSubIndex,
label,
...rest
}) => {
const [focused, setFocused] = useState(false);
const itemRef = useRef();
// const clearPressedJob = useRef(
// new Job((func) => {
// setTimeout(func, 0);
// }, 0)
// );
const clearPressedJob = useRef(new Job((func) => func(), 0));
const _onClick = useCallback(
@@ -65,11 +59,12 @@ const TabItemBase = ({
const _onFocus = useCallback(() => {
setFocused(true);
setSelectedSubItemId(null);
setSelectedSubIndex(index);
if (onFocus) {
onFocus(index);
}
}, [index, onFocus, setSelectedSubItemId]);
}, [index, onFocus, setSelectedSubItemId, setSelectedSubIndex]);
const _onBlur = useCallback(() => {
setFocused(false);