Skip to content

fix(#3505): Fix icon click and focus on Link#3664

Merged
chrisolsen merged 1 commit intodevfrom
copilot/3505-fix-link-icon-click
Mar 25, 2026
Merged

fix(#3505): Fix icon click and focus on Link#3664
chrisolsen merged 1 commit intodevfrom
copilot/3505-fix-link-icon-click

Conversation

@bdfranck
Copy link
Collaborator

@bdfranck bdfranck commented Mar 24, 2026

This PR fixes the following issues in the link component:

  1. Clicking a leading or trailing icon clicks the slotted anchor element

click-link-icon-test

  1. Only show a single focus ring on focus
image

@bdfranck bdfranck marked this pull request as ready for review March 24, 2026 16:57
@bdfranck bdfranck requested a review from ArakTaiRoth March 24, 2026 16:57
@bdfranck bdfranck force-pushed the copilot/3505-fix-link-icon-click branch from 9ace3eb to e7a3430 Compare March 24, 2026 17:04
@bdfranck bdfranck requested a review from chrisolsen March 24, 2026 17:04
@bdfranck bdfranck linked an issue Mar 24, 2026 that may be closed by this pull request
const spy = vi.fn();

result.container
.querySelector("[data-testid='anchor']")
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could replace this with

cont anchor = result.getByTestId("anchore"); 
...
await waitFor(() => {
  anchor.element().addEventListener(...)
})


result.container
.querySelector("[data-testid='anchor']")
?.addEventListener("click", spy);
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point! I've updated the tests.

@bdfranck bdfranck force-pushed the copilot/3505-fix-link-icon-click branch from e7a3430 to 2fa68e8 Compare March 24, 2026 20:29
@bdfranck bdfranck requested a review from chrisolsen March 24, 2026 20:31
@chrisolsen chrisolsen merged commit 903fd30 into dev Mar 25, 2026
4 checks passed
@chrisolsen chrisolsen deleted the copilot/3505-fix-link-icon-click branch March 25, 2026 15:28
@chrisolsen
Copy link
Collaborator

🎉 This PR is included in version 1.41.0-dev.27 🎉

The release is available on:

Your semantic-release bot 📦🚀

@chrisolsen
Copy link
Collaborator

🎉 This PR is included in version 6.11.0-dev.17 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Link: Clicking leading or trailing icon does not trigger link

3 participants