- Notifications
You must be signed in to change notification settings - Fork26.8k
feat(docs-infra): Adds copy link to anchor functionality#65712
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
github-actionsbot commentedNov 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Deployed adev-preview for060fc4e to:https://ng-dev-previews-fw--pr-angular-angular-65712-adev-prev-shulgigx.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
JeanMeche commentedNov 28, 2025
Thanks for the suggestion, I like the general idea but the tooltip is a bit too much visual noise imho. Maybe we should only copy the lick (and show the tooltip) when hovering that link icon ? |
SkyZeroZx commentedNov 28, 2025
Updated |
JeanMeche commentedNov 29, 2025
Enables copying a direct link to any section by clicking its anchor. Also updates the aria-label to remove the code tag.
| constcustomId=customIdRegex.exec(anchorLessText)?.[1]; | ||
| constlink=customId??getHeaderId(anchorLessText); | ||
| constlabel=anchorLessText.replace(/`(.*?)`/g,'<code>$1</code>').replace(customIdRegex,''); | ||
| constnormalizedLabel=label.replace(/<\/?code>/g,''); |
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'm adding this to prevent the tag code from going in the aria label; I don't know if we can take the previoustext, but from what I understand it wouldn't be possible.

Uh oh!
There was an error while loading.Please reload this page.
Enables copying a direct link to any section by clicking its anchor. Also updates the aria-label to remove the code tag.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Currently when clicked in clipboard icon only navigate to anchor and don't copy o anything
What is the new behavior?
Add a tooltip that provides a similar user experience to the one used in the Chrome developer docs.
Also normalized text when
codetag is used in aria labelDoes this PR introduce a breaking change?