Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip component requires custom code outside the component #30

Open
pursuitofleisure opened this issue Jan 10, 2025 · 0 comments
Open

Comments

@pursuitofleisure
Copy link
Contributor

pursuitofleisure commented Jan 10, 2025

The Tooltip component only outputs the tooltip text, and does not work by itself unless the user manually places it inside a couple of wrapper divs with mandatory classes:

<div class="relative inline-block [--tooltip-arrow-size:20px]">
  <div class="inline-block peer/target">
    <.button aria-describedby="tooltip-md-top">MD</.button>
  </div>
  <.tooltip direction="top" id="tooltip-md-top">Tooltip text</.tooltip>
</div>

The styling within the Tooltip component relies on the specific classes of those wrapper divs in order to show on hover, along with some element to trigger the tooltip. This requires a lot of manual work for the user, and I think this would work better if those wrapper divs were also included in the component, and offered slots for both the tooltip and the trigger element (button, link, etc.).

We would also need to make sure the ID of the tooltip matches the aria-describedby attribute of the trigger element for accessibility purposes.

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

No branches or pull requests

1 participant