Skip to content

Commit

Permalink
fix: [Modal] fix autoFocus
Browse files Browse the repository at this point in the history
  • Loading branch information
akai committed Jan 25, 2022
1 parent 55160f0 commit f902b50
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/Modal/Base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ export const Base: React.FC<ModalProps> = (props) => {
const { didMount, isShow } = useMount({ active, ref: wrapper });

useEffect(() => {
if (autoFocus && wrapper.current) {
wrapper.current.focus();
}
setTimeout(() => {
if (autoFocus && wrapper.current) {
wrapper.current.focus();
}
});
}, [autoFocus]);

useEffect(() => {
Expand Down

0 comments on commit f902b50

Please sign in to comment.