Skip to content

Conversation

birosrichard
Copy link
Contributor

closes: #1993 (comment)

Create a new Heading component using the Swizzling method.

Updated how the "Copy to clipboard" buttons look so it is consistent with the web.

Also had an issue with scrolling to the desired id, so I had to useBrokenLinks hook

@birosrichard birosrichard self-assigned this Oct 10, 2025
@github-actions github-actions bot added this to the 125th sprint - Web team milestone Oct 10, 2025
@github-actions github-actions bot added the t-web Issues with this label are in the ownership of the web team. label Oct 10, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

Comment @cursor review or bugbot run to trigger another review on this PR

aria-label={anchorTitle}
>
<LinkIcon size="16" />
</a>
Copy link

Choose a reason for hiding this comment

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

Bug: Anchor Link Renders Incorrectly Without ID

The component renders an anchor link and copy button even when the id prop is undefined or null. This causes the anchor's href attribute to become "#undefined", while the copy-to-clipboard functionality handles a missing id differently. This inconsistency leads to broken navigation and unexpected copied URLs.

Fix in Cursor Fix in Web

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable to add nullable check for id

@apify-service-account
Copy link

Preview for this PR was built for commit 7f3bf8bb and is ready at https://pr-1999.preview.docs.apify.com!

Copy link
Contributor

@katzino katzino left a comment

Choose a reason for hiding this comment

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

LGTM 🤝
Have some smaller nits for you to consider

Comment on lines 33 to 35
if (id) {
brokenLinks.collectAnchor(id);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would call this method directly inside component's body. useEffect might be a proper place

aria-label={anchorTitle}
>
<LinkIcon size="16" />
</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems reasonable to add nullable check for id


.headingCopyIcon {
display: none;
transform: translateX(0.25rem);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this line does anything

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It actually made a space from the left, but I used a different approach

HonzaTuron

This comment was marked as outdated.

Copy link
Contributor

@HonzaTuron HonzaTuron left a comment

Choose a reason for hiding this comment

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

Is hook necessary?

@webrdaniel
Copy link
Contributor

There is some error in the build 👀

@apify-service-account
Copy link

Preview for this PR was built for commit baf70a46 and is ready at https://pr-1999.preview.docs.apify.com!

Copy link
Contributor

@webrdaniel webrdaniel left a comment

Choose a reason for hiding this comment

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

It copied: [object Object] 😄
Also, the copied state does not show or just flickers

Screen.Recording.2025-10-13.at.13.51.18.mov

@apify-service-account
Copy link

Preview for this PR was built for commit c865fd2b and is ready at https://pr-1999.preview.docs.apify.com!

@apify-service-account
Copy link

Preview for this PR was built for commit a8e91645 and is ready at https://pr-1999.preview.docs.apify.com!

Copy link
Contributor

@webrdaniel webrdaniel left a comment

Choose a reason for hiding this comment

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

Let's go for that ✊

@birosrichard birosrichard merged commit b949f91 into master Oct 13, 2025
9 checks passed
@birosrichard birosrichard deleted the feat/add-copy-to-clipboard-functionality branch October 13, 2025 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-web Issues with this label are in the ownership of the web team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add copy to clipboard functionallity for anchor links

5 participants