Skip to content

Commit

Permalink
fix(project): scroll to top on static pages
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaDTH authored and AntonLantukh committed Apr 22, 2024
1 parent 11a0e32 commit a9a0d1f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import { Helmet } from 'react-helmet';
import { shallow } from '@jwp/ott-common/src/utils/compare';
import type { PlaylistItem } from '@jwp/ott-common/types/playlist';
Expand All @@ -16,6 +16,10 @@ const MediaStaticPage: ScreenComponent<PlaylistItem> = ({ data }) => {
const pageTitle = `${data.title} - ${siteName}`;
const canonicalUrl = data ? `${window.location.origin}${mediaURL({ media: data })}` : window.location.href;

useEffect(() => {
(document.scrollingElement || document.body).scroll({ top: 0 });
}, [data]);

return (
<>
<Helmet>
Expand Down

0 comments on commit a9a0d1f

Please sign in to comment.