[251028] fix: ProductAllSection focus-within 대체로직 삭제
🕐 커밋 시간: 2025. 10. 28. 24:24:07 📊 변경 통계: • 총 파일: 1개 • 추가: +31줄 • 삭제: -30줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/views/DetailPanel/ProductAllSection/ProductAllSection.jsx 🔧 주요 변경 내용: • 소규모 기능 개선 • 코드 정리 및 최적화
This commit is contained in:
@@ -533,37 +533,38 @@ export default function ProductAllSection({
|
||||
}, [onReady, isOnRender]);
|
||||
|
||||
// WebOS TV focus-within 대체 로직
|
||||
useEffect(() => {
|
||||
const detailAreaElement = document.querySelector('.detailArea');
|
||||
if (!detailAreaElement) return;
|
||||
// useEffect(() => {
|
||||
// const detailAreaElement = document.querySelector('.detailArea');
|
||||
// if (!detailAreaElement) return;
|
||||
|
||||
let hasFocus = false;
|
||||
// let hasFocus = false;
|
||||
|
||||
const handleFocusIn = () => {
|
||||
if (!hasFocus) {
|
||||
hasFocus = true;
|
||||
detailAreaElement.classList.add('focused');
|
||||
}
|
||||
};
|
||||
// const handleFocusIn = () => {
|
||||
// if (!hasFocus) {
|
||||
// hasFocus = true;
|
||||
// detailAreaElement.classList.add('focused');
|
||||
// }
|
||||
// };
|
||||
|
||||
const handleFocusOut = () => {
|
||||
setTimeout(() => {
|
||||
const activeElement = document.activeElement;
|
||||
if (!detailAreaElement.contains(activeElement)) {
|
||||
hasFocus = false;
|
||||
detailAreaElement.classList.remove('focused');
|
||||
}
|
||||
}, 10);
|
||||
};
|
||||
// const handleFocusOut = () => {
|
||||
// setTimeout(() => {
|
||||
// const activeElement = document.activeElement;
|
||||
// if (!detailAreaElement.contains(activeElement)) {
|
||||
// hasFocus = false;
|
||||
// detailAreaElement.classList.remove('focused');
|
||||
// }
|
||||
// }, 10);
|
||||
// };
|
||||
|
||||
detailAreaElement.addEventListener('focusin', handleFocusIn);
|
||||
detailAreaElement.addEventListener('focusout', handleFocusOut);
|
||||
// detailAreaElement.addEventListener('focusin', handleFocusIn);
|
||||
// detailAreaElement.addEventListener('focusout', handleFocusOut);
|
||||
|
||||
// return () => {
|
||||
// detailAreaElement.removeEventListener('focusin', handleFocusIn);
|
||||
// detailAreaElement.removeEventListener('focusout', handleFocusOut);
|
||||
// };
|
||||
// }, []);
|
||||
|
||||
return () => {
|
||||
detailAreaElement.removeEventListener('focusin', handleFocusIn);
|
||||
detailAreaElement.removeEventListener('focusout', handleFocusOut);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// 컴포넌트 unmount 시 모든 timer cleanup
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user