Skip to content

fix: Ensure Tooltips work with anchors that have an as prop#684

Merged
frankieyan merged 2 commits intomainfrom
frankie/tooltip-anchor-as-prop
Aug 19, 2022
Merged

fix: Ensure Tooltips work with anchors that have an as prop#684
frankieyan merged 2 commits intomainfrom
frankie/tooltip-anchor-as-prop

Conversation

@frankieyan
Copy link
Copy Markdown
Member

@frankieyan frankieyan commented Aug 16, 2022

Short description

This fixes an issue where if you used a tooltip anchor with an as prop, it gets doubly applied, creates a nested element, and loses the anchor's children in the process 😬

Example:

<Tooltip content="Some helpful info">
  <Box as={Link} to="/help">Hover me for info</Box>
</Tooltip>

...would result in something like:

<a href="/help">
  <a href="/help"> />
<a>

You could test this in storybook by undoing the fix, then using <Box as={Button}> as an anchor.

PR Checklist

  • Added tests for bugs / new features
  • Updated docs (storybooks, readme)
  • Executed npm run validate and made sure no errors / warnings were shown
  • Described changes in CHANGELOG.md
  • Bumped version in package.json and package-lock.json (npm --no-git-tag-version version <major|minor|patch>) ref
  • Updated all static build artifacts (npm run build-all)

Versioning

Patch release

@frankieyan frankieyan force-pushed the frankie/tooltip-anchor-as-prop branch from d1743cb to e528fd7 Compare August 16, 2022 16:05
@frankieyan frankieyan changed the title fix: Ensure Tooltips work with anchors that has an as prop fix: Ensure Tooltips work with anchors that have an as prop Aug 16, 2022
@frankieyan frankieyan requested review from a team and craigcarlyle and removed request for a team August 16, 2022 16:06
Copy link
Copy Markdown
Contributor

@craigcarlyle craigcarlyle left a comment

Choose a reason for hiding this comment

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

🚀

@frankieyan frankieyan merged commit 831fbc2 into main Aug 19, 2022
@frankieyan frankieyan deleted the frankie/tooltip-anchor-as-prop branch August 19, 2022 04:20
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.

2 participants