feat(tooltip): add pf-v6-tooltip element#3141
Conversation
🦋 Changeset detectedLatest commit: b52089b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Commitlint tests passed!More Info{
"valid": true,
"errors": [],
"warnings": [],
"input": "feat(tooltip): add pf-v6-tooltip element"
} |
✅ Deploy Preview for patternfly-elements ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Port tooltip to v6 design tokens and patterns. - FloatingDOMController with arrow element positioning - Cancellable TooltipShowEvent/TooltipHideEvent with reason enum - `trigger` attribute (IDREF) and property (Element ref) - `entry-delay`/`exit-delay` attributes (default 300ms) - `alignment` attribute (start/end/left/right) - `position`, `no-flip`, `flip-behavior` carried from v5 - `light-dark()` CSS fallbacks for inverse color scheme - `ariaDescribedByElements` wiring on show/hide - Escape key dismissal - 9 demos including playground, color-scheme, and element-ref trigger - 17 unit tests covering API, a11y, events, and cancellation Closes #3048 Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaced by pf-v6-tooltip. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0b0a955 to
683110f
Compare
This comment has been minimized.
This comment has been minimized.
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Cross-root
|
- Static document keydown listener for Escape (works with external triggers) - Screen reader announcer via static `role="status"` live region - `silent` attribute to opt out of announcements - Remove physical `'left'`/`'right'` from `TooltipAlignment`, keep logical `'start'`/`'end'` only - Remove `color-scheme: light dark` from `:host` so tooltip inherits container scheme and inverts correctly via `light-dark()` - Fix `user-select: initial` to `auto` - Why-comments on `ariaDescribedByElements` cross-root limitation and intentional bidirectional `visible` state - Improved JSDoc for cem health (66 -> 85): element description, slot a11y notes, CSS token refs, event detail shapes, added missing `--pf-v6-c-tooltip__arrow--BoxShadow` `@cssprop` Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- hide event firing and reason - focusin/focusout triggers - Element reference trigger property - flip-behavior attribute parsing - visible attribute (declarative) - slot overrides content attribute - cancel hide event - Escape key with external trigger (document listener) - silent attribute Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Demonstrate feature parity with React trigger modes using cancelable show/hide events: - click-trigger: click-to-toggle tooltip via preventDefault on hover - manual-trigger: checkbox-controlled tooltip via preventDefault on both hover and focus triggers Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Not a standalone demo on patternfly.org; alignment is covered by the options playground demo. Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add static live-region announcer pattern for tooltip/popover content (from rh-tooltip) - Update cross-root ARIA section with WPT test link and spec references (WICG/aom#192, whatwg/html#5401, WICG/webcomponents#1086) Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zeroedin
left a comment
There was a problem hiding this comment.
Rename PR feat(tooltip)!: port to pf-v6-tooltip
| "@patternfly/elements": minor | ||
| --- | ||
|
|
||
| `pf-v6-tooltip`: New tooltip element with hover/focus activation, configurable placement, entry/exit delays, flip behavior, external trigger support, rich content via slot, and cancelable show/hide events. |
There was a problem hiding this comment.
This should be a major and follow the major changeset format
---
"@patternfly/elements": major
---
✨ Added `<pf-v6-tooltip>` replacing `<pf-v5-tooltip>`. Tooltip now follows
PatternFly v6 design specs.
{{ example usage here }}
** Breaking Changes from v5 **
- {{Breaking changes here}}| | `animationDuration` | CSS transitions | Override via stylesheet instead of prop | | ||
| | `distance` | Hardcoded 15px | Not configurable; React default also 15 | | ||
| | `isVisible` | `visible` | Boolean attribute; also controllable via `.show()` / `.hide()` methods | | ||
| | `minWidth` | Not supported | No CSS custom property exposed | |
There was a problem hiding this comment.
minWidth should be moved to Not Implemented.
| | `distance` | Hardcoded 15px | Not configurable; React default also 15 | | ||
| | `isVisible` | `visible` | Boolean attribute; also controllable via `.show()` / `.hide()` methods | | ||
| | `minWidth` | Not supported | No CSS custom property exposed | | ||
| | `zIndex` | Not supported | Hardcoded to 10000 in shadow DOM | |
There was a problem hiding this comment.
I'm hesitant about the hardcoded value here. I feel like we should offer a way to change it. I understand that there is no current CSS var, react is using an inline style prop drill. I can see this as an issue in some implementations if it cannot be fixed. Edge cases, sure, but hard-coding a high z-index is a bad practice.
would it be better to offer a net new css var here to allow an escape hatch and document it under "Added"?
| | `hide` event | Cancelable event before tooltip hides, with trigger `reason` | | ||
| | `.show()` / `.hide()` methods | Programmatic visibility control | | ||
| | `content` slot | Rich HTML content, not available in React (which takes `ReactNode`) | | ||
| | CSS custom properties | 13 custom properties for fine-grained style control without JS | |
There was a problem hiding this comment.
The CSS properties not not "Added" this line should be removed
Summary
pf-v6-tooltipelement ported from v5 with v6 design tokensTooltipShowEvent/TooltipHideEventwithreasonenum for selective trigger preventiontriggerattribute (IDREF) and property (Element ref) for external trigger elementsentry-delay/exit-delay(default 300ms),alignment(start/end/left/right),position,no-flip,flip-behaviorlight-dark()CSS fallbacks for correct inverse color schemeariaDescribedByElementswiring between trigger and tooltip contentTest plan
alignmentattribute changes text-alignentry-delay/exit-delayin options playgroundno-flipdisables repositioning/review-a11y,/review-api,/review-demosCloses #3048