Skip to content

Commit

Permalink
fix page scrolling when changing anything on operator page
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubik committed Oct 27, 2023
1 parent 747ee6a commit 8d231c2
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions components/ui/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,8 @@ import Link from 'next/link';

export default function Tabs({ options, selected, href }) {
useEffect(() => {
if (options.length && selected) {
const selectedOption = options.find((option) => option.value === selected);
if (selectedOption) {
document.querySelector(`.tabs-btn.-active`).scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'center' });
}
}
}, [options, selected]);
document.querySelector(`.tabs-btn.-active`).scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'center' });
}, []);

return (
<header className="c-tabs">
Expand Down

0 comments on commit 8d231c2

Please sign in to comment.