alphagov / alphagov/tech-docs-gem
Bug: Link in navigation point to the right ID when a heading is shared between two pages
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 16
- Forks
- 47
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 14
Description
What should change
The computation of unique IDs for the links in the navigation gives the wrong results when:
- two pages share a common heading
- you're on one of these two pages
- the navigation has a link to the other page pointing to the shared heading
The link points to an ID composed of the heading and the previous heading (for ex. /javascript-api-reference/#javascript-api-reference-button), as if the target was on the current page. It should instead be only the heading (in the example /javascript-api-reference/#button) as on the other page, the ID is unique.
To reproduce:
- checkout this commit of govuk-frontend-docs (dd1d088), -
npm install, bundle installbundle exec middleman server- Navigate to "Sass API Reference"
- Expand the menu item for "JavaScript API Reference"
- The "Button" link will point to
#javascript-api-reference-button, while when browsing the other pages, it points to#button
User need
When publishing the latest release of the design system, we had our JavaScript API Reference and Sass API Reference both list the Button component, leading to the issue described. A situation that may happen further as both docs get expanded and list the options for our components. Other documentations with repetitive structure/content across pages may run into this issue as well.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue from commit dd1d088 using npm install, bundle install, and bundle exec middleman server. Trace how navigation links compute heading IDs when browsing from Sass API Reference to JavaScript API Reference, then verify that the shared Button link resolves to #button rather than the current-page-prefixed ID.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100