Skip to content
This repository has been archived by the owner on Sep 19, 2021. It is now read-only.

don't jump to top when navigating within a page #510

Merged
merged 2 commits into from
Jul 9, 2018
Merged

Conversation

afeld
Copy link
Contributor

@afeld afeld commented Jul 6, 2018

Fixes #502.

The problem

When navigation between sections using keyboard input, focus would stay on the sidebar unless forced elsewhere. (remix-run/react-router#5210)

The solution for https://github.com/ryanhofdotgov/e-QIP-prototype-truetandem/issues/1358 was to to move focus to the main content area whenever the Section component was "updated". Unfortunately, this was too aggressive, and would also be triggered when navigating within the page.

The solution

Only move focus when the browser URL path changes, and do so using a more reliable means of referencing the element.

Fixes issue with page scrolling up when navigating within a page.
@afeld afeld requested a review from line47 July 6, 2018 23:04
@afeld afeld force-pushed the in-page-nav-fix branch from caf2cf9 to d5d14da Compare July 6, 2018 23:06
Copy link
Contributor

@line47 line47 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@afeld afeld merged commit a50dac8 into develop Jul 9, 2018
@afeld afeld deleted the in-page-nav-fix branch July 9, 2018 17:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants