-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(SkipToContent): Update skip to content to support react router #4831
feat(SkipToContent): Update skip to content to support react router #4831
Conversation
PF4 preview: https://patternfly-react-pr-4831.surge.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add new prop to demo app please and add an integration test.
17f491a
to
7250653
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a SkipToContent anywhere in OpenShift, but if there was one my guess is that it has href="/#main-content"
instead of href="#main-content"
which is causing your undesired behavior.
All react-router does in addition to the default browser behavior for hash links of document.getElementById('main-content').scrollTo()
is check to see which route it should render, which should always be the same if not using a HashRouter. In the case of SkipToContent we should always want the browser behavior to take place, not a router's.
I'm happy to help you debug.
It doesn't work because of the <SkipToContent href={`${this.props.location.pathname}#content`}>Skip to Content</SkipToContent>` |
@redallen react-router has some issues with hash links afaik. see remix-run/react-router#394 (comment) |
What: Closes #4809