@vaadin/tooltip 25.3.0-alpha7 → 25.3.0-alpha8

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.
@@ -23,7 +23,7 @@
23
23
  "declarations": [
24
24
  {
25
25
  "kind": "mixin",
26
- "description": "A mixin providing linking of the tooltip content to the tooltip target\nelements using the `aria-describedby` or `aria-labelledby` attribute.",
26
+ "description": "A mixin providing linking of the tooltip content to the tooltip target\nelements using the `aria-describedby` or `aria-labelledby` attribute.\n\nTargets in the same root as the tooltip are linked by the content element\nID. ID references only resolve within a single tree scope, so targets in\nother roots are linked with ARIA element references instead.",
27
27
  "name": "TooltipAriaMixin",
28
28
  "members": [
29
29
  {
@@ -718,30 +718,6 @@
718
718
  }
719
719
  }
720
720
  ],
721
- "mixins": [
722
- {
723
- "name": "TooltipMixin",
724
- "module": "src/vaadin-tooltip-mixin.js"
725
- },
726
- {
727
- "name": "ThemePropertyMixin",
728
- "package": "@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js"
729
- },
730
- {
731
- "name": "ElementMixin",
732
- "package": "@vaadin/component-base/src/element-mixin.js"
733
- },
734
- {
735
- "name": "PolylitMixin",
736
- "package": "@vaadin/component-base/src/polylit-mixin.js"
737
- }
738
- ],
739
- "superclass": {
740
- "name": "LitElement",
741
- "package": "lit"
742
- },
743
- "tagName": "vaadin-tooltip",
744
- "customElement": true,
745
721
  "attributes": [
746
722
  {
747
723
  "name": "aria-link-mode",
@@ -862,8 +838,39 @@
862
838
  "name": "TooltipMixin",
863
839
  "module": "src/vaadin-tooltip-mixin.js"
864
840
  }
841
+ },
842
+ {
843
+ "type": {
844
+ "text": "string"
845
+ },
846
+ "description": "The theme variants to apply to the component.",
847
+ "name": "theme"
865
848
  }
866
- ]
849
+ ],
850
+ "mixins": [
851
+ {
852
+ "name": "TooltipMixin",
853
+ "module": "src/vaadin-tooltip-mixin.js"
854
+ },
855
+ {
856
+ "name": "ThemePropertyMixin",
857
+ "package": "@vaadin/vaadin-themable-mixin/vaadin-theme-property-mixin.js"
858
+ },
859
+ {
860
+ "name": "ElementMixin",
861
+ "package": "@vaadin/component-base/src/element-mixin.js"
862
+ },
863
+ {
864
+ "name": "PolylitMixin",
865
+ "package": "@vaadin/component-base/src/polylit-mixin.js"
866
+ }
867
+ ],
868
+ "superclass": {
869
+ "name": "LitElement",
870
+ "package": "lit"
871
+ },
872
+ "tagName": "vaadin-tooltip",
873
+ "customElement": true
867
874
  }
868
875
  ],
869
876
  "exports": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/tooltip",
3
- "version": "25.3.0-alpha7",
3
+ "version": "25.3.0-alpha8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,20 +35,20 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "25.3.0-alpha7",
39
- "@vaadin/component-base": "25.3.0-alpha7",
40
- "@vaadin/markdown": "25.3.0-alpha7",
41
- "@vaadin/overlay": "25.3.0-alpha7",
42
- "@vaadin/popover": "25.3.0-alpha7",
43
- "@vaadin/vaadin-themable-mixin": "25.3.0-alpha7",
38
+ "@vaadin/a11y-base": "25.3.0-alpha8",
39
+ "@vaadin/component-base": "25.3.0-alpha8",
40
+ "@vaadin/markdown": "25.3.0-alpha8",
41
+ "@vaadin/overlay": "25.3.0-alpha8",
42
+ "@vaadin/popover": "25.3.0-alpha8",
43
+ "@vaadin/vaadin-themable-mixin": "25.3.0-alpha8",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@vaadin/aura": "25.3.0-alpha7",
48
- "@vaadin/chai-plugins": "25.3.0-alpha7",
49
- "@vaadin/test-runner-commands": "25.3.0-alpha7",
47
+ "@vaadin/aura": "25.3.0-alpha8",
48
+ "@vaadin/chai-plugins": "25.3.0-alpha8",
49
+ "@vaadin/test-runner-commands": "25.3.0-alpha8",
50
50
  "@vaadin/testing-helpers": "^2.0.0",
51
- "@vaadin/vaadin-lumo-styles": "25.3.0-alpha7",
51
+ "@vaadin/vaadin-lumo-styles": "25.3.0-alpha8",
52
52
  "sinon": "^22.0.0"
53
53
  },
54
54
  "customElements": "custom-elements.json",
@@ -56,5 +56,5 @@
56
56
  "web-types.json",
57
57
  "web-types.lit.json"
58
58
  ],
59
- "gitHead": "ae7b9823df5598faebd7a482993029ee489c35ae"
59
+ "gitHead": "ccbb4aaffb63c745c6da0426b532d4d05e47af29"
60
60
  }
@@ -8,6 +8,10 @@ import type { Constructor } from '@open-wc/dedupe-mixin';
8
8
  /**
9
9
  * A mixin providing linking of the tooltip content to the tooltip target
10
10
  * elements using the `aria-describedby` or `aria-labelledby` attribute.
11
+ *
12
+ * Targets in the same root as the tooltip are linked by the content element
13
+ * ID. ID references only resolve within a single tree scope, so targets in
14
+ * other roots are linked with ARIA element references instead.
11
15
  */
12
16
  export declare function TooltipAriaMixin<T extends Constructor<HTMLElement>>(
13
17
  base: T,
@@ -3,14 +3,21 @@
3
3
  * Copyright (c) 2026 - 2026 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
+ import { addAriaElementReference, removeAriaElementReference } from '@vaadin/a11y-base/src/aria-element-reference.js';
6
7
  import { addValueToAttribute, removeValueFromAttribute } from '@vaadin/component-base/src/dom-utils.js';
7
8
 
8
9
  /**
9
10
  * A mixin providing linking of the tooltip content to the tooltip target
10
11
  * elements using the `aria-describedby` or `aria-labelledby` attribute.
12
+ *
13
+ * Targets in the same root as the tooltip are linked by the content element
14
+ * ID. ID references only resolve within a single tree scope, so targets in
15
+ * other roots are linked with ARIA element references instead.
11
16
  */
12
17
  export const TooltipAriaMixin = (superClass) =>
13
18
  class TooltipAriaMixinClass extends superClass {
19
+ #ariaReferences = [];
20
+
14
21
  static get properties() {
15
22
  return {
16
23
  /**
@@ -52,41 +59,62 @@ export const TooltipAriaMixin = (superClass) =>
52
59
  }
53
60
 
54
61
  /** @protected */
55
- updated(props) {
56
- super.updated(props);
62
+ connectedCallback() {
63
+ super.connectedCallback();
64
+ this.#addAriaReferences();
65
+ }
57
66
 
58
- const ariaTargetChanged = props.has('_effectiveAriaTarget');
59
- const ariaLinkModeChanged = props.has('ariaLinkMode');
67
+ /** @protected */
68
+ disconnectedCallback() {
69
+ super.disconnectedCallback();
70
+ this.#removeAriaReferences();
71
+ }
60
72
 
61
- if (ariaTargetChanged || ariaLinkModeChanged) {
62
- const oldTarget = ariaTargetChanged ? props.get('_effectiveAriaTarget') : this._effectiveAriaTarget;
63
- const oldMode = ariaLinkModeChanged ? props.get('ariaLinkMode') : this.ariaLinkMode;
64
- this.#removeAriaReferences(oldTarget, oldMode);
73
+ /** @protected */
74
+ updated(props) {
75
+ super.updated(props);
65
76
 
66
- const newTarget = this._effectiveAriaTarget;
67
- const newMode = this.ariaLinkMode;
68
- this.#addAriaReferences(newTarget, newMode);
77
+ if (props.has('_effectiveAriaTarget') || props.has('ariaLinkMode')) {
78
+ this.#updateAriaReferences();
69
79
  }
70
80
  }
71
81
 
72
- #addAriaReferences(target, mode) {
73
- if (!target || !mode || mode === 'none') {
82
+ #addAriaReferences() {
83
+ const mode = this.ariaLinkMode;
84
+ const targets = this._effectiveAriaTarget;
85
+ const contentNode = this.__contentNode;
86
+ if (!contentNode || !targets || !mode || mode === 'none') {
74
87
  return;
75
88
  }
76
89
 
77
- [target].flat().forEach((el) => {
78
- addValueToAttribute(el, mode, this._uniqueId);
90
+ [targets].flat().forEach((target) => {
91
+ const byReference = target.getRootNode() !== this.getRootNode();
92
+ if (byReference) {
93
+ addAriaElementReference(target, mode, contentNode);
94
+ } else {
95
+ addValueToAttribute(target, mode, contentNode.id);
96
+ }
97
+
98
+ this.#ariaReferences.push({ target, mode, byReference });
79
99
  });
80
100
  }
81
101
 
82
- #removeAriaReferences(target, mode) {
83
- if (!target || !mode || mode === 'none') {
84
- return;
85
- }
102
+ #removeAriaReferences() {
103
+ const contentNode = this.__contentNode;
86
104
 
87
- [target].flat().forEach((el) => {
88
- removeValueFromAttribute(el, mode, this._uniqueId);
105
+ this.#ariaReferences.forEach(({ target, mode, byReference }) => {
106
+ if (byReference) {
107
+ removeAriaElementReference(target, mode, contentNode);
108
+ } else {
109
+ removeValueFromAttribute(target, mode, contentNode.id);
110
+ }
89
111
  });
112
+ this.#ariaReferences = [];
113
+ }
114
+
115
+ #updateAriaReferences() {
116
+ this.#removeAriaReferences();
117
+ this.#addAriaReferences();
90
118
  }
91
119
 
92
120
  /** @private */
@@ -16,6 +16,7 @@ import { tooltipOverlayStyles } from './styles/vaadin-tooltip-overlay-base-style
16
16
  /**
17
17
  * An element used internally by `<vaadin-tooltip>`. Not intended to be used separately.
18
18
  *
19
+ * @attr {string} theme - The theme variants to apply to the component.
19
20
  * @customElement vaadin-tooltip-overlay
20
21
  * @extends HTMLElement
21
22
  * @private
@@ -73,6 +73,7 @@ import { TooltipMixin } from './vaadin-tooltip-mixin.js';
73
73
  *
74
74
  * @fires {CustomEvent} content-changed - Fired when the tooltip text content is changed.
75
75
  *
76
+ * @attr {string} theme - The theme variants to apply to the component.
76
77
  * @customElement vaadin-tooltip
77
78
  * @extends HTMLElement
78
79
  */
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/tooltip",
4
- "version": "25.3.0-alpha7",
4
+ "version": "25.3.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -105,9 +105,7 @@
105
105
  "description": "The theme variants to apply to the component.",
106
106
  "value": {
107
107
  "type": [
108
- "string",
109
- "null",
110
- "undefined"
108
+ "string"
111
109
  ]
112
110
  }
113
111
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/tooltip",
4
- "version": "25.3.0-alpha7",
4
+ "version": "25.3.0-alpha8",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {