Skip to content

Commit

Permalink
[Onboarding] Scroll to the top on the page when navigating to a quick…
Browse files Browse the repository at this point in the history
… start view (elastic#182844)

Closes elastic#182157

- Adds a hook to watch for location path updates reset the page's scroll
position
  • Loading branch information
mykolaharmash authored May 8, 2024
1 parent da78b1b commit 099c909
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { i18n } from '@kbn/i18n';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import React from 'react';
import React, { useEffect } from 'react';
import { Route, Routes } from '@kbn/shared-ux-router';
import { useNavigate, useLocation } from 'react-router-dom-v5-compat';
import { EuiButtonEmpty, EuiPageTemplate, EuiSpacer } from '@elastic/eui';
Expand All @@ -22,6 +22,12 @@ import { CustomLogsPanel } from './quickstart_flows/custom_logs';
const queryClient = new QueryClient();

export function ExperimentalOnboardingFlow() {
const { pathname } = useLocation();

useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);

return (
<QueryClientProvider client={queryClient}>
<EuiPageTemplate.Section
Expand Down

0 comments on commit 099c909

Please sign in to comment.