tpopup spotlight focus

This commit is contained in:
hyunwoo93.cha
2024-07-15 12:14:23 +09:00
parent 2b090e50c8
commit 5c156118e5

View File

@@ -1,7 +1,7 @@
import React, { useCallback, useEffect, useMemo } from "react";
import classNames from "classnames";
import { useDispatch } from "react-redux";
import { useDispatch, useSelector } from "react-redux";
import Alert from "@enact/sandstone/Alert";
import Spotlight from "@enact/spotlight";
@@ -87,6 +87,19 @@ export default function TPopUp({
...rest
}) {
const dispatch = useDispatch();
const popupVisible = useSelector((state) => state.common.popup.popupVisible);
useEffect(() => {
if (popupVisible) {
const timerId = setTimeout(() => {
Spotlight.focus(SpotlightIds.TPOPUP);
}, 0);
return () => {
clearTimeout(timerId);
};
}
}, [popupVisible]);
useEffect(() => {
if (KINDS.indexOf(kind) < 0) {