@descope/web-components-ui 3.1.12 → 3.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -24017,7 +24017,7 @@ class RawTooltip extends BaseClass$1 {
24017
24017
  this.tooltip.style.overflow = 'hidden';
24018
24018
  this.tooltip.style.position = 'absolute';
24019
24019
  }
24020
-
24020
+
24021
24021
  #revealWrappedParts() {
24022
24022
  this.tooltip.style.width = '100%';
24023
24023
  this.tooltip.style.height = '100%';
@@ -24042,9 +24042,7 @@ class RawTooltip extends BaseClass$1 {
24042
24042
  #setTooltipTarget() {
24043
24043
  if (!this.children?.length) return;
24044
24044
 
24045
- let ele = Array.from(this.children).find(
24046
- (child) => child !== this.tooltip,
24047
- );
24045
+ let ele = Array.from(this.children).find((child) => child !== this.tooltip);
24048
24046
 
24049
24047
  if (!ele) return;
24050
24048
 
@@ -24064,6 +24062,10 @@ class RawTooltip extends BaseClass$1 {
24064
24062
  return enrichedText;
24065
24063
  }
24066
24064
 
24065
+ get srLabel() {
24066
+ return this.tooltip?.querySelector('[slot="sr-label"]');
24067
+ }
24068
+
24067
24069
  #initTooltipTextComponent() {
24068
24070
  if (!this.overlayContentNode) return;
24069
24071
 
@@ -24074,6 +24076,12 @@ class RawTooltip extends BaseClass$1 {
24074
24076
 
24075
24077
  this.overlayContentNode.appendChild(this.textComponent);
24076
24078
 
24079
+ // An empty sr-label with role="tooltip" fails accessibility checks.
24080
+ // Hide it when there's no tooltip text; vaadin handles populating it when text is present.
24081
+ if (this.srLabel && !this.tooltipText) {
24082
+ this.srLabel.setAttribute('aria-hidden', 'true');
24083
+ }
24084
+
24077
24085
  forwardAttrs$1(this, this.textComponent, {
24078
24086
  includeAttrs: ['readonly'],
24079
24087
  });
@@ -24109,7 +24117,15 @@ class RawTooltip extends BaseClass$1 {
24109
24117
 
24110
24118
  #updateText(value) {
24111
24119
  if (!this.textComponent) return;
24112
- this.textComponent.textContent = value?.trim();
24120
+ const trimmedValue = (value ?? '').trim();
24121
+ this.textComponent.textContent = trimmedValue;
24122
+ if (this.srLabel) {
24123
+ if (trimmedValue) {
24124
+ this.srLabel.removeAttribute('aria-hidden');
24125
+ } else {
24126
+ this.srLabel.setAttribute('aria-hidden', 'true');
24127
+ }
24128
+ }
24113
24129
  }
24114
24130
 
24115
24131
  attributeChangedCallback(attrName, oldValue, newValue) {
@@ -24121,7 +24137,7 @@ class RawTooltip extends BaseClass$1 {
24121
24137
  }
24122
24138
 
24123
24139
  if (attrName === 'opened') {
24124
- this.#handleTooltipVisibility(attrName, newValue);
24140
+ this.#handleTooltipVisibility();
24125
24141
  }
24126
24142
  }
24127
24143
  }