Merge pull request #264 from sartography/feature/ui-tweaks

Force all pages back to the top, rather than just a few of them.
This commit is contained in:
Dan Funk 2023-05-17 12:29:27 -04:00 committed by GitHub
commit de6b51f05b
4 changed files with 15 additions and 2 deletions

View File

@ -15,6 +15,8 @@ import { AbilityContext } from './contexts/Can';
import UserService from './services/UserService';
import ErrorDisplay from './components/ErrorDisplay';
import APIErrorProvider from './contexts/APIErrorContext';
import ScrollToTop from "./components/ScrollToTop";
import React from "react";
export default function App() {
if (!UserService.isLoggedIn()) {
@ -32,6 +34,7 @@ export default function App() {
<BrowserRouter>
<NavigationBar />
<Content>
<ScrollToTop />
<ErrorDisplay />
<ErrorBoundary>
<Routes>

View File

@ -109,7 +109,6 @@ export default function ErrorDisplay() {
if (errorObject) {
const title = 'Error:';
window.scrollTo(0, 0); // Scroll back to the top of the page
errorTag = (
<Notification title={title} onClose={() => removeError()} type="error">

View File

@ -0,0 +1,12 @@
import { useEffect } from "react";
import { useLocation } from "react-router-dom";
export default function ScrollToTop() {
const { pathname } = useLocation();
useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
return null;
}

View File

@ -116,7 +116,6 @@ export default function TaskShow() {
if (!result.can_complete) {
navigateToInterstitial(result);
}
window.scrollTo(0, 0); // Scroll back to the top of the page
/* Disable call to load previous tasks -- do not display menu.
const url = `/v1.0/process-instances/for-me/${modifyProcessIdentifierForPathParam(