Skip to content

Commit

Permalink
Lagt til en id på containeren på venstre side - denne brukes for å fi…
Browse files Browse the repository at this point in the history
…nne containeren og scrolle til topp. (#2872)
  • Loading branch information
gunnsteingarmo authored Aug 22, 2024
1 parent 900454f commit 880f72f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/frontend/Felles/ScrollToTop/ScrollToTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ export default function ScrollToTop() {
const { pathname } = useLocation();

useEffect(() => {
window.scrollTo(0, 0);
const scrollTilTopp = () => {
const container = document.querySelector('#scroll-topp');
if (container) {
container.scrollTop = 0;
} else {
window.scrollTo(0, 0);
}
};

scrollTilTopp();
}, [pathname]);

return null;
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/Komponenter/Behandling/BehandlingSide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const SideInnhold: FC<Props> = ({ behandling, personopplysninger, fagsak }) => {
fagsak={fagsak}
/>
<Container>
<InnholdWrapper $åpenHøyremeny={åpenHøyremeny}>
<InnholdWrapper $åpenHøyremeny={åpenHøyremeny} id="scroll-topp">
<Fanemeny behandling={behandling} />
<SettPåVent behandling={behandling} />
<InfostripeUtestengelse />
Expand Down

0 comments on commit 880f72f

Please sign in to comment.