Skip to content
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

Fix anchor links in tabs component panels #1031

Merged
merged 4 commits into from
Oct 15, 2018
Merged

Conversation

NickColley
Copy link
Contributor

@NickColley NickColley commented Oct 15, 2018

Fixes #1030

When clicking an anchor in the tabs component panel, it will trigger the 'hashchange' event which the tabs component is listening to.
The component then checks to see if there's any tabs within the component that match this hash, but did so in a way that could also include regular anchor links.

This pull request ensures it is only checking that the hash matches available tabs only.

I've also tested the following scenarios manually:

  1. Editing the URL directly
  2. Clicking the anchor with no existing hash
  3. Clicking the anchor when a hash already exists.

Previously this selector was fairly specific enough, but by explicitly using a govuk-frontend class, this removes any last issues. Unless a user tries to nest tabs...
This ensures that any anchors that are in a tab panel do not get mistaken for a tab by reusing the `getTab` function that now is more specific.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1031 October 15, 2018 12:26 Inactive
@NickColley NickColley changed the title Fix anchors in tabs Fix anchor links in tabs component panels Oct 15, 2018
Copy link
Contributor

@36degrees 36degrees left a comment

Choose a reason for hiding this comment

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

👍

@NickColley NickColley merged commit e22a3e3 into master Oct 15, 2018
@NickColley NickColley deleted the fix-anchors-in-tabs branch October 15, 2018 15:28
@kr8n3r kr8n3r added this to the [NEXT] milestone Oct 16, 2018
@alex-ju
Copy link
Contributor

alex-ju commented Oct 24, 2018

@NickColley thanks a lot for looking into this! 🙏

@kr8n3r kr8n3r mentioned this pull request Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants