kopia lustrzana https://github.com/shoelace-style/shoelace
Fix aria-describedby in tooltip targets
rodzic
c9d0905b44
commit
6b5c5aad5f
|
@ -13,6 +13,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis
|
||||||
- Fixed a bug where `disabled` could be set when buttons are rendered as links
|
- Fixed a bug where `disabled` could be set when buttons are rendered as links
|
||||||
- Fixed a bug where hoisted dropdowns would render in the wrong position when place inside an `sl-dialog`
|
- Fixed a bug where hoisted dropdowns would render in the wrong position when place inside an `sl-dialog`
|
||||||
- Fixed a bug where boolean aria attributes didn't explicitly set `true|false` string values in the DOM
|
- Fixed a bug where boolean aria attributes didn't explicitly set `true|false` string values in the DOM
|
||||||
|
- Fixed a bug where `aria-describedby` was never set on tooltip targets in `sl-tooltip`
|
||||||
- Improved `sl-icon-button` accessibility by encouraging proper use of `label` and hiding the internal icon from screen readers
|
- Improved `sl-icon-button` accessibility by encouraging proper use of `label` and hiding the internal icon from screen readers
|
||||||
- Improved `sl-dropdown` accessibility by attaching `aria-haspopup` and `aria-expanded` to the slotted trigger
|
- Improved `sl-dropdown` accessibility by attaching `aria-haspopup` and `aria-expanded` to the slotted trigger
|
||||||
- Removed `console.log` from modal utility
|
- Removed `console.log` from modal utility
|
||||||
|
|
|
@ -202,8 +202,10 @@ export class Tooltip {
|
||||||
const oldTarget = this.target;
|
const oldTarget = this.target;
|
||||||
const newTarget = this.getTarget();
|
const newTarget = this.getTarget();
|
||||||
|
|
||||||
if (oldTarget && newTarget !== oldTarget) {
|
if (newTarget !== oldTarget) {
|
||||||
oldTarget.removeAttribute('aria-describedby');
|
if (oldTarget) {
|
||||||
|
oldTarget.removeAttribute('aria-describedby');
|
||||||
|
}
|
||||||
newTarget.setAttribute('aria-describedby', this.componentId);
|
newTarget.setAttribute('aria-describedby', this.componentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +229,7 @@ export class Tooltip {
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<Host onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
<Host onMouseOver={this.handleMouseOver} onMouseOut={this.handleMouseOut}>
|
||||||
<slot aria-describedby={this.componentId} onSlotchange={this.handleSlotChange} />
|
<slot onSlotchange={this.handleSlotChange} />
|
||||||
|
|
||||||
{!this.disabled && (
|
{!this.disabled && (
|
||||||
<div ref={el => (this.tooltipPositioner = el)} class="tooltip-positioner">
|
<div ref={el => (this.tooltipPositioner = el)} class="tooltip-positioner">
|
||||||
|
|
Ładowanie…
Reference in New Issue