Skip to content

Make the heading anchor an interactive copy-URL button - #3303

Merged
enf0rc3 merged 2 commits into
mainfrom
wl/copy-heading-url
Aug 6, 2026
Merged

Make the heading anchor an interactive copy-URL button#3303
enf0rc3 merged 2 commits into
mainfrom
wl/copy-heading-url

Conversation

@enf0rc3

@enf0rc3 enf0rc3 commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

NES-282 · CopyHeadingUrl design

Add the copy-url-button to all headings in .page-content as per spec:
image

Results

scripts/modules/headers.js already created these elements on load, so it keeps doing that and now wires the behaviour as well:

function enhanceHeaders() {
  addCopyButtons();   // one per heading
  addCopyListener();  // one delegated click handler for the page
}

Both glyphs come from design-system-icons and are byte-identical to LinkOnIcon.tsx and CheckIcon.tsx, on the 0 0 40 40 viewBox its IconWrapper uses.

Example:
image
image

Accessibility

Each heading gets an aria-label of its own text. A heading is named from its contents, and those contents include a nested control's accessible name, so every heading was otherwise announced with the button's label appended:

before   heading "Install Octopus Server Copy link to this section"
after    heading "Install Octopus Server"

That was true of the old anchor too, with Link to this section, so this closes a pre-existing defect.

Also

Removes the heading samples from index.md. They existed to show the button in a forced-visible state, which is unnecessary now that it is interactive.

🤖 Generated with Claude Code

Base automatically changed from wl/icon-assets-into-src to main August 5, 2026 20:58
@enf0rc3
enf0rc3 force-pushed the wl/copy-heading-url branch from 48857f3 to 02a39c7 Compare August 5, 2026 21:11
@enf0rc3
enf0rc3 changed the base branch from main to wl/clipboard-module August 5, 2026 21:12
@team-marketing-branch-protections

Copy link
Copy Markdown

Pull request environment is available at https://stoctodocspr3303.z22.web.core.windows.net.

You can view the ephemeral environment status in Octopus Deploy.

This environment will be automatically deprovisioned when the pull request is closed, or after 7 days of inactivity.

@enf0rc3
enf0rc3 force-pushed the wl/copy-heading-url branch from 02a39c7 to 1d74547 Compare August 5, 2026 22:15
@enf0rc3 enf0rc3 changed the title Build the heading copy button from the CopyHeadingUrl design Add the heading copy button from the CopyHeadingUrl design Aug 5, 2026
@enf0rc3
enf0rc3 changed the base branch from wl/clipboard-module to main August 5, 2026 22:16
@enf0rc3
enf0rc3 force-pushed the wl/copy-heading-url branch from 1d74547 to 785f6aa Compare August 5, 2026 22:51
@enf0rc3 enf0rc3 changed the title Add the heading copy button from the CopyHeadingUrl design Make the heading anchor a copy-URL button Aug 5, 2026
@enf0rc3
enf0rc3 force-pushed the wl/copy-heading-url branch from 785f6aa to 6097a28 Compare August 5, 2026 23:13
status.textContent = message;
}

function enhanceHeaders() {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Called by main.js after loading the page

@enf0rc3
enf0rc3 force-pushed the wl/copy-heading-url branch 8 times, most recently from 2bc2cb9 to e795773 Compare August 6, 2026 01:10
Comment thread src/pages/index.md
- [Oldest content](/report/oldest-content/1)
- [Taxonomy](/report/taxonomy)

## Headings \{#headings}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't really like this so opted to remove it, we already have similar stuff on /components

NES-282. The button beside each heading was an anchor that jumped to the
fragment. It now copies the heading URL, shows a tick and reverts after two
seconds.

enhanceHeaders still builds the buttons on load and now wires the behavior:
addCopyButtons creates them, addCopyListener attaches one delegated click
handler for the page.

Scoped to .page-content headings with an id, so the feedback prompt and the
navigation are left alone. Each heading also gets an aria-label of its own text:
a heading is named from its contents, which include a nested control name, so
without it every heading was announced with the button label on the end.

The box and the hover, pressed and focus-ring states come from .btn.btn--xsmall,
which was already the same 28px icon button. Both glyphs come from
design-system-icons, and the tooltip matches the design system tooltip.

Drops the heading samples from index.md - the button is interactive now, so a
forced-visible copy is not needed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@enf0rc3
enf0rc3 force-pushed the wl/copy-heading-url branch from e795773 to 0e9a76e Compare August 6, 2026 01:55
@enf0rc3 enf0rc3 changed the title Make the heading anchor a copy-URL button Make the heading anchor an interactive copy-URL button Aug 6, 2026

@borland borland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tested on the staging site, LGTM

@enf0rc3

enf0rc3 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

Pushed trivial pixel-perfect placement of tooltip changes and re-tested. still centered.

image

@enf0rc3
enf0rc3 merged commit 5f3eebc into main Aug 6, 2026
7 checks passed
@enf0rc3
enf0rc3 deleted the wl/copy-heading-url branch August 6, 2026 03:51
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.

3 participants