Skip to content

feat(router): support custom elements for RouterLink#60290

Closed
kyubisation wants to merge 1 commit into
angular:mainfrom
kyubisation:routerlink-custom-elements
Closed

feat(router): support custom elements for RouterLink#60290
kyubisation wants to merge 1 commit into
angular:mainfrom
kyubisation:routerlink-custom-elements

Conversation

@kyubisation

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Relates to #28345

We as Web Component library authors have the problem that routerLink does not properly work with custom element anchor tags (native anchor tag wrapped in Shadow DOM). This is due to the lack of automatic href updates for elements besides <a>/<area> and the internal logic of adding a tabindex="0" attribute for non <a>/<area> elements.

What is the new behavior?

If routerLink is used on a registered custom element, the static property/getter observedAttributes on the custom element class is checked for an href attribute. If href is part of observedAttributes treats the element as if it was a native <a> element.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove Bot requested a review from atscott March 8, 2025 22:17
@angular-robot angular-robot Bot added detected: feature PR contains a feature commit area: router labels Mar 8, 2025
@ngbot ngbot Bot added this to the Backlog milestone Mar 8, 2025
@atscott atscott added the requires: TGP This PR requires a passing TGP before merging is allowed label Mar 14, 2025
@pullapprove pullapprove Bot removed the requires: TGP This PR requires a passing TGP before merging is allowed label Mar 14, 2025
@kyubisation

Copy link
Copy Markdown
Contributor Author

Hello @atscott
Thank you for the approval. 👍
What will be the next step for this PR?

@atscott

atscott commented Mar 27, 2025

Copy link
Copy Markdown
Contributor

TGP is green.

@atscott atscott added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release labels Mar 27, 2025
@thePunderWoman

Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit ff98ccb.

The changes were merged into the following branches: main

@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: router detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants