-
Notifications
You must be signed in to change notification settings - Fork 8
feat(tooltip): simplify implementation #3368
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
Open
jpzwarte
wants to merge
57
commits into
main
Choose a base branch
from
feature/3344-tooltip-property-on-button
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
cea790b
🚟
jpzwarte a0b4a8c
🏄
jpzwarte b087599
💚
jpzwarte e6172ae
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte 7979d82
🏄
jpzwarte 58f0fd5
🌐
jpzwarte 1e00db6
🎭
jpzwarte b04be06
🎾
jpzwarte 61d6159
👽
jpzwarte cbcb785
🐿
jpzwarte 6a863c1
🌅
jpzwarte c023493
📺
jpzwarte 1c5a951
🍹
jpzwarte d952039
🎈
jpzwarte 2ec2c5e
🍹
jpzwarte 32ef3e7
⛷
jpzwarte 619f69e
🐛
jpzwarte caf4dc9
🔋
jpzwarte 038e53e
🦄
jpzwarte 4c27908
🐝
jpzwarte 1bc5248
🛠
jpzwarte 448df62
🍵
jpzwarte d8c1e1c
🐋
jpzwarte a260509
❄️
jpzwarte 2a3072c
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte 5236177
🔋
jpzwarte 0cbe05c
😸
jpzwarte e6eb7d3
🌄
jpzwarte cf25977
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte 36c87ae
🍉
jpzwarte 5d7c664
🚒
jpzwarte 3b05565
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte 2cc6659
😋
jpzwarte f23ed32
🍒
jpzwarte dbf9e6e
🚃
jpzwarte ed764d3
🛩
jpzwarte 933aaa2
🌭
jpzwarte ee21384
🎂
jpzwarte 51c1e96
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte 0a0c0a6
⭐️
jpzwarte 15244c2
🦄
jpzwarte 76bfd44
🐧
jpzwarte 63a0b59
🏂
jpzwarte b8009a8
🐘
jpzwarte a944d65
🎖
jpzwarte 52100b1
🐏
jpzwarte ddd256a
🏖
jpzwarte 876ce64
🎨
jpzwarte 7db9e85
🎊
jpzwarte 56de807
🐽
jpzwarte 8234ac1
🚣
jpzwarte 6991922
🐼
jpzwarte 5b26224
🎆
jpzwarte 2f09a01
🐆
jpzwarte 79f38ba
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte 2d1fd1d
🐭
jpzwarte 586a8eb
Merge branch 'main' into feature/3344-tooltip-property-on-button
jpzwarte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| --- | ||
| '@sl-design-system/button': minor | ||
| '@sl-design-system/menu': minor | ||
| '@sl-design-system/tag': minor | ||
| '@sl-design-system/toggle-button': minor | ||
| --- | ||
|
|
||
| Add `tooltip` property | ||
|
|
||
| Previously, adding a tooltip to any kind of component required adding a sibling `<sl-tooltip>` element manually and wiring up the correct `aria-describedby` or `aria-labelledby` relationship by hand. This was especially cumbersome for icon-only buttons, where the tooltip doubles as the accessible label. | ||
|
|
||
| The new `tooltip` property improves the Developer Experience by letting you set a tooltip directly on the component. | ||
|
|
||
| For buttons, it handles all the accessibility wiring automatically: | ||
|
|
||
| - For **icon-only buttons** the tooltip text acts as the accessible label (`aria-labelledby`). | ||
| - For **text buttons** the tooltip text acts as an accessible description (`aria-describedby`). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| --- | ||
| '@sl-design-system/toggle-button': minor | ||
| --- | ||
|
|
||
| Refactor toggle button to use an internal `<button>` element. This improves accessibility and removes the need for manual keyboard and ARIA handling. | ||
|
|
||
| **Breaking changes** | ||
|
|
||
| - The `[pressed]`, `[icon-only]`, `[text-only]`, and `[error]` attributes have been replaced by CSS custom states (`:state(pressed)`, `:state(icon-only)`, `:state(text-only)`, `:state(error)`). Update any custom styles targeting these attributes. | ||
| - The `shape` property type has changed from `ButtonShape` to `ToggleButtonShape` (`'square' | 'pill'`). | ||
| - The `pressed` property is no longer reflected as an attribute. Use `:state(pressed)` for styling. | ||
| - The `label` property (previously reflected as `aria-label`) has been removed. Use the new `tooltip` property instead. | ||
|
|
||
| **New features** | ||
|
|
||
| - Added a `tooltip` property for declaratively adding a tooltip. For icon-only buttons the tooltip acts as the accessible label; for other buttons it acts as an accessible description. | ||
| - Added CSS parts `button` and `tooltip` for styling the internal elements. | ||
| - Focus is now delegated to the internal `<button>` via `delegatesFocus: true`. | ||
| - ARIA attributes set on the host are now forwarded to the internal `<button>` via `ForwardAriaMixin`. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sl-design-system/shared': minor | ||
| --- | ||
|
|
||
| When forwarding ARIA labels or descriptions, the `ForwardAriaMixin` no longer overrides any existing `ariaDescribedByElements` or `ariaLabelledByElements` values. This allows components that use the mixin to maintain their own ARIA relationships without interference, while still forwarding any additional ARIA attributes as needed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@sl-design-system/button-bar': patch | ||
| --- | ||
|
|
||
| Fix not giving buttons enough time to set the icon-only state |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@sl-design-system/angular': minor | ||
| --- | ||
|
|
||
| Use the new tooltip implementation | ||
|
|
||
| The tooltip directive has been updated to use the new tooltip implementation. This means that the tooltip is now created as a separate element and positioned using the `for` attribute. The old implementation, which used a lazy loader, has been removed. The API of the tooltip directive remains the same, but the DOM structure may have changed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@sl-design-system/avatar': minor | ||
| '@sl-design-system/calendar': minor | ||
| '@sl-design-system/ellipsize-text': minor | ||
| '@sl-design-system/grid': minor | ||
| --- | ||
|
|
||
| Use the new tooltip implementation |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@sl-design-system/menu': patch | ||
| --- | ||
|
|
||
| Fix clicking a second time did not dismiss the menu | ||
|
|
||
| When a user clicked the menu button to open the menu and then clicked it again to close it, the menu would immediately reopen. This happened because the button click fired after the popover's `toggle` event, causing the button's click handler to call `togglePopover()` again on an already-closed menu. The fix tracks a `#popoverJustClosed` flag via the `beforetoggle` event and skips the click handler when the flag is set. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@sl-design-system/breadcrumbs': minor | ||
| --- | ||
|
|
||
| Use the new tooltip implementation | ||
|
|
||
| The breadcrumbs component has been updated to use the simplified tooltip implementation. Tooltips for truncated breadcrumb links are now managed using the new `<sl-tooltip>` `for` attribute approach, removing the need for manual cleanup functions and reducing internal complexity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| --- | ||
| '@sl-design-system/tooltip': major | ||
| --- | ||
|
|
||
| Rewrite of the tooltip component: the tooltip was the component responsible for the most bug reports and had a complex internal implementation. This rewrite significantly simplifies the component. | ||
|
|
||
| The complex internal positioning logic, `AnchorController`, `EventsController`, and `lazy()` static method have been removed in favour of native browser `popover` and CSS Anchor Positioning APIs. | ||
|
|
||
| > [!NOTE] | ||
| > CSS Anchor Positioning is not yet supported in all browsers. You may need to include the [CSS Anchor Positioning polyfill](https://anchor-positioning.oddbird.net/) in your application. | ||
|
|
||
| #### Breaking changes | ||
|
|
||
| - The `TooltipOptions` interface and `Tooltip.lazy()` static method have been removed. Use the `for` attribute to link a tooltip to its anchor instead. | ||
| - The `position`, `offset`, `maxWidth`, `arrowPadding`, and `viewportMargin` properties/statics have been removed. | ||
| - `hoverShowDelay` changed from `500ms` to `150ms` and `hoverHideDelay` changed from `200ms` to `0ms`. | ||
|
|
||
| #### New API | ||
|
|
||
| - `for` — links the tooltip to an anchor element by ID | ||
| - `type` — controls the ARIA relationship: `'label'` (`ariaLabelledByElements`, default) or `'description'` (`ariaDescribedByElements`) | ||
|
jpzwarte marked this conversation as resolved.
|
||
| - `trigger` — space-separated list of triggers: `'focus'`, `'hover'`, and/or `'click'` (default: `'focus hover'`) | ||
|
jpzwarte marked this conversation as resolved.
|
||
| - `disabled` — prevents the tooltip from showing | ||
| - `open` — reflects the current open state | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with this many breaking changes, is it still a
minorversion update?