tpopup spotlight focus
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user