Focus baby, Focus!
This commit is contained in:
parent
2386675c52
commit
ae7af1998d
|
|
@ -10,6 +10,7 @@ export function FavoriteBar({teams}) {
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
const headingRef = useRef(null);
|
const headingRef = useRef(null);
|
||||||
const favoriteBarRef = useRef(null);
|
const favoriteBarRef = useRef(null);
|
||||||
|
const scrollButtonRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedFavorite = localStorage.getItem('favoriteTeam');
|
const savedFavorite = localStorage.getItem('favoriteTeam');
|
||||||
|
|
@ -45,6 +46,9 @@ export function FavoriteBar({teams}) {
|
||||||
localStorage.setItem('favoriteTeam', team.id);
|
localStorage.setItem('favoriteTeam', team.id);
|
||||||
setIsPulsing(true);
|
setIsPulsing(true);
|
||||||
headingRef.current.scrollIntoView({behavior: 'smooth', block: 'center'});
|
headingRef.current.scrollIntoView({behavior: 'smooth', block: 'center'});
|
||||||
|
if (scrollButtonRef.current) {
|
||||||
|
scrollButtonRef.current.focus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setIsVisible(false); // Close the favorite menu
|
setIsVisible(false); // Close the favorite menu
|
||||||
};
|
};
|
||||||
|
|
@ -104,6 +108,7 @@ export function FavoriteBar({teams}) {
|
||||||
title="Zum aktuellen Spiel des Favoriten springen"
|
title="Zum aktuellen Spiel des Favoriten springen"
|
||||||
onClick={scrollToFavorite}
|
onClick={scrollToFavorite}
|
||||||
className={isPulsing ? 'pulse-animation' : ''}
|
className={isPulsing ? 'pulse-animation' : ''}
|
||||||
|
innerRef={scrollButtonRef}
|
||||||
>
|
>
|
||||||
<FaArrowTurnDown />
|
<FaArrowTurnDown />
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue