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

Draft: Tooltips / Popper support #46

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Conversation

micolous
Copy link
Contributor

@micolous micolous commented Sep 8, 2024

Based on #45

This adds support for tooltips with popper-rs.

Bootstrap tooltips are built with Popper. Both Yew and Popper assume they have complete control of the DOM, so Popper needs some extra wiring to handle the component lifecycle correctly, which popper-rs provides.

This takes some ideas from react-bootstrap's Tooltip implementation, but goes for a slightly simpler model, where Tooltips are dropped into a portal directly (like popper-rs' example), and the Tooltip component is responsible for all the event handling (rather than Overlay and OverlayTrigger).

To position the tooltip correctly and mark the target element with accessibility attributes, you need to expose a NodeRef for each component you want to add a tooltip to. I've exposed NodeRefs for Button, FormControl and Link.

Unlike regular Bootstrap, this doesn't support tooltips from data attributes.

I've added examples using all of those controls, and also a direct ref= attribute on a HTML elements.

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.

1 participant