@iyulab/components 2.38.0 → 2.39.0
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/CHANGELOG.md +39 -0
- package/dist/components/alert/UAlert.js +2 -1
- package/dist/components/button/UButton.d.ts +4 -0
- package/dist/components/button/UButton.js +16 -4
- package/dist/components/calendar/UCalendar.js +4 -3
- package/dist/components/calendar/date-text-controller.d.ts +1 -1
- package/dist/components/calendar/date-text-controller.js +2 -2
- package/dist/components/carousel/UCarousel.js +3 -2
- package/dist/components/checkbox/UCheckbox.styles.js +4 -0
- package/dist/components/chip/UChip.js +3 -2
- package/dist/components/command-palette/UCommandPalette.js +2 -1
- package/dist/components/copy-button/UCopyButton.js +3 -2
- package/dist/components/date-picker/UDatePicker.js +9 -8
- package/dist/components/date-range-picker/UDateRangePicker.js +8 -7
- package/dist/components/dialog/UDialog.js +2 -1
- package/dist/components/drawer/UDrawer.js +2 -1
- package/dist/components/field/UField.js +3 -2
- package/dist/components/file-input/UFileInput.js +2 -1
- package/dist/components/input/UInput.js +5 -4
- package/dist/components/menu-item/UMenuItem.js +2 -1
- package/dist/components/pagination/UPagination.js +4 -3
- package/dist/components/popover/UPopover.d.ts +1 -0
- package/dist/components/popover/UPopover.js +10 -4
- package/dist/components/rating/URating.js +7 -6
- package/dist/components/select/USelect.js +3 -2
- package/dist/components/switch/USwitch.styles.js +2 -0
- package/dist/components/tab/UTab.js +2 -1
- package/dist/components/tree-item/UTreeItem.js +4 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/utilities/listenInShadow.d.ts +14 -0
- package/dist/utilities/listenInShadow.js +86 -0
- package/package.json +1 -1
- package/skills/iyulab-components/SKILL.md +1 -0
- package/skills/iyulab-components/references/utilities/listen-in-shadow.md +79 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.39.0] - 2026-10-31
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **`delegate(type, handler)` and `listenInShadow(root, type, selector, handler)`** — event handlers for the parts of a
|
|
8
|
+
shadow tree, heard on the shadow root instead of on the part. A `click`, `mousedown` or `mouseup` listener on an
|
|
9
|
+
element makes screen readers announce it (and everything inside it) as «clickable» unless its role is button, link,
|
|
10
|
+
menuitem, tab, option, radio, checkbox or switch; a listener on the shadow root is not announced. `delegate` is a Lit
|
|
11
|
+
element directive used in place of `@click`: handlers run innermost first and `stopPropagation()` stops the ones
|
|
12
|
+
further out; the element arrives as the second argument (`currentTarget` is the shadow root). A `null` or
|
|
13
|
+
`undefined` handler listens to nothing, like `@click=${undefined}`.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- **Screen readers no longer announce «clickable» on our buttons, field labels and fields.** Measured with NVDA in
|
|
18
|
+
browse mode, every `u-button` read as «clickable, button», and `u-field` labels, the `u-date-picker` /
|
|
19
|
+
`u-date-range-picker` field and its label, the `u-select` field, calendar days, menu and tree item headers, rating
|
|
20
|
+
symbols and the clear, password, stepper, remove, close and page buttons inside other components were announced the
|
|
21
|
+
same way — each carried a click listener on an element. They are now heard on the shadow root.
|
|
22
|
+
- **`u-popover` hears a click on its anchor on the anchor's root** (the document or the shadow root it lives in) rather
|
|
23
|
+
than on the anchor element, so the anchor is not announced as «clickable».
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- **`u-button` sets `role="none"` on its host** unless you set a role. The host only wraps the inner `<button>`; marking
|
|
28
|
+
it presentational keeps your own `click` listener on a `u-button` from being announced as «clickable». A host with
|
|
29
|
+
`aria-label` (or another global ARIA attribute) stays exposed — browsers ignore `role="none"` then. `u-button` now
|
|
30
|
+
hears clicks on its shadow root; `click()` on the host keeps the same rules (does nothing while disabled or loading,
|
|
31
|
+
submits or resets its form). A click event you dispatch on the host yourself no longer submits — call `click()`.
|
|
32
|
+
|
|
33
|
+
## [2.38.1] - 2026-10-31
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- **`u-checkbox` and `u-switch` take a press on the whole row they stand in.** The press goes to the inner label, which
|
|
38
|
+
was one line high — with a touch target (`--u-target-size: 44px`) the host stood 44px tall but its top and bottom
|
|
39
|
+
bands did nothing. The label now fills the target height (the checkbox pads its single line, the switch has a minimum
|
|
40
|
+
height); at the default 24px the row looks as before.
|
|
41
|
+
|
|
3
42
|
## [2.38.0] - 2026-10-31
|
|
4
43
|
|
|
5
44
|
### Added
|
|
@@ -5,6 +5,7 @@ import { styles } from "./UAlert.styles.js";
|
|
|
5
5
|
import { Locale } from "../../utilities/Locale.js";
|
|
6
6
|
import { devWarnOnce } from "../../utilities/devWarning.js";
|
|
7
7
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
8
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html } from "lit";
|
|
@@ -70,7 +71,7 @@ var UAlert = class UAlert extends UElement {
|
|
|
70
71
|
appearance="plain"
|
|
71
72
|
?hidden=${!this.closable}
|
|
72
73
|
aria-label=${Locale.getValue("close")}
|
|
73
|
-
|
|
74
|
+
${delegate("click", this.hide)}>
|
|
74
75
|
<u-icon lib="internal" name="x"></u-icon>
|
|
75
76
|
</u-button>
|
|
76
77
|
</div>
|
|
@@ -115,6 +115,9 @@ export declare class UButton extends UElement {
|
|
|
115
115
|
get form(): HTMLFormElement | null;
|
|
116
116
|
connectedCallback(): void;
|
|
117
117
|
disconnectedCallback(): void;
|
|
118
|
+
private readonly aria;
|
|
119
|
+
/** 호스트에서 시작하는 클릭(`button.click()`)은 섀도 루트를 지나지 않는다 — 같은 규칙(비활성 · 제출)을 여기서. */
|
|
120
|
+
click(): void;
|
|
118
121
|
/**
|
|
119
122
|
* 호스트에 세팅된 `aria-label`은 실제 접근 가능한(포커스 대상) 엘리먼트가 아니라 —
|
|
120
123
|
* 그 안쪽 shadow DOM 의 네이티브 `<a>`/`<button>`이다. 섀도우 경계를 넘지 않으므로
|
|
@@ -140,6 +143,7 @@ export declare class UButton extends UElement {
|
|
|
140
143
|
private renderContent;
|
|
141
144
|
private renderMask;
|
|
142
145
|
private handleClick;
|
|
146
|
+
private submitOrReset;
|
|
143
147
|
private handleSpinnerSlotChange;
|
|
144
148
|
}
|
|
145
149
|
declare global {
|
|
@@ -3,6 +3,7 @@ import { UElement } from "../UElement.js";
|
|
|
3
3
|
import { styles } from "./UButton.styles.js";
|
|
4
4
|
import { FORWARDED_ARIA, readForwardedAria } from "./forwarded-aria.js";
|
|
5
5
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
6
|
+
import { HostAria } from "../../utilities/hostAria.js";
|
|
6
7
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
7
8
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
8
9
|
import { html } from "lit";
|
|
@@ -20,14 +21,14 @@ var UButton = class UButton extends UElement {
|
|
|
20
21
|
this.formDisabled = false;
|
|
21
22
|
this.loading = false;
|
|
22
23
|
this.type = "button";
|
|
24
|
+
this.aria = new HostAria(this);
|
|
23
25
|
this.handleClick = (e) => {
|
|
24
26
|
if (this.effectivelyDisabled || this.loading) {
|
|
25
27
|
e.preventDefault();
|
|
26
28
|
e.stopImmediatePropagation();
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
|
-
|
|
30
|
-
else if (this.type === "reset") this.form?.reset();
|
|
31
|
+
this.submitOrReset();
|
|
31
32
|
};
|
|
32
33
|
this.handleSpinnerSlotChange = (e) => {
|
|
33
34
|
const hasSpinner = e.target.assignedNodes().length > 0;
|
|
@@ -66,12 +67,19 @@ var UButton = class UButton extends UElement {
|
|
|
66
67
|
connectedCallback() {
|
|
67
68
|
super.connectedCallback();
|
|
68
69
|
if (!this.internals && "attachInternals" in this) this.internals = this.attachInternals();
|
|
69
|
-
this.addEventListener("click", this.handleClick);
|
|
70
|
+
this.renderRoot.addEventListener("click", this.handleClick);
|
|
71
|
+
this.aria.set("role", "none");
|
|
70
72
|
}
|
|
71
73
|
disconnectedCallback() {
|
|
72
|
-
this.removeEventListener("click", this.handleClick);
|
|
74
|
+
this.renderRoot.removeEventListener("click", this.handleClick);
|
|
73
75
|
super.disconnectedCallback();
|
|
74
76
|
}
|
|
77
|
+
/** 호스트에서 시작하는 클릭(`button.click()`)은 섀도 루트를 지나지 않는다 — 같은 규칙(비활성 · 제출)을 여기서. */
|
|
78
|
+
click() {
|
|
79
|
+
if (this.effectivelyDisabled || this.loading) return;
|
|
80
|
+
super.click();
|
|
81
|
+
this.submitOrReset();
|
|
82
|
+
}
|
|
75
83
|
/**
|
|
76
84
|
* 호스트에 세팅된 `aria-label`은 실제 접근 가능한(포커스 대상) 엘리먼트가 아니라 —
|
|
77
85
|
* 그 안쪽 shadow DOM 의 네이티브 `<a>`/`<button>`이다. 섀도우 경계를 넘지 않으므로
|
|
@@ -170,6 +178,10 @@ var UButton = class UButton extends UElement {
|
|
|
170
178
|
</div>
|
|
171
179
|
`;
|
|
172
180
|
}
|
|
181
|
+
submitOrReset() {
|
|
182
|
+
if (this.type === "submit") this.form?.requestSubmit();
|
|
183
|
+
else if (this.type === "reset") this.form?.reset();
|
|
184
|
+
}
|
|
173
185
|
};
|
|
174
186
|
__decorate([property({
|
|
175
187
|
type: String,
|
|
@@ -4,6 +4,7 @@ import { Locale } from "../../utilities/Locale.js";
|
|
|
4
4
|
import { formatDate } from "../../utilities/format.js";
|
|
5
5
|
import { addDays, addMonths, daysInMonth, isDayUnavailable, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate } from "./dates.js";
|
|
6
6
|
import { styles } from "./UCalendar.styles.js";
|
|
7
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
7
8
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
8
9
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
9
10
|
import { html } from "lit";
|
|
@@ -114,9 +115,9 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
114
115
|
return html`
|
|
115
116
|
<div class="month" part="calendar-month">
|
|
116
117
|
<div class="calendar-header" part="calendar-header">
|
|
117
|
-
${first ? html`<u-icon-button lib="internal" name="chevron-left" aria-label=${Locale.getValue("previousMonth")}
|
|
118
|
+
${first ? html`<u-icon-button lib="internal" name="chevron-left" aria-label=${Locale.getValue("previousMonth")} ${delegate("click", this.handlePrevMonth)}></u-icon-button>` : html`<span class="nav-spacer"></span>`}
|
|
118
119
|
<span class="calendar-title" part="calendar-title">${monthLabel}</span>
|
|
119
|
-
${last ? html`<u-icon-button lib="internal" name="chevron-right" aria-label=${Locale.getValue("nextMonth")}
|
|
120
|
+
${last ? html`<u-icon-button lib="internal" name="chevron-right" aria-label=${Locale.getValue("nextMonth")} ${delegate("click", this.handleNextMonth)}></u-icon-button>` : html`<span class="nav-spacer"></span>`}
|
|
120
121
|
</div>
|
|
121
122
|
<div class="calendar-weekdays" part="calendar-weekdays" role="row">
|
|
122
123
|
${weekdayLabels.map((w) => html`<span class="weekday" role="columnheader">${w}</span>`)}
|
|
@@ -155,7 +156,7 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
155
156
|
?data-range-start=${!!range && isSameDay(date, range[0])}
|
|
156
157
|
?data-range-end=${!!range && isSameDay(date, range[1])}
|
|
157
158
|
?data-preview=${inRange && !!this.anchor}
|
|
158
|
-
|
|
159
|
+
${delegate("click", () => this.activate(date))}
|
|
159
160
|
@keydown=${(e) => this.handleDayKeydown(e, date)}
|
|
160
161
|
@focus=${() => {
|
|
161
162
|
this.focusedDate = date;
|
|
@@ -58,7 +58,7 @@ export declare class DateTextController implements ReactiveController {
|
|
|
58
58
|
* gaps — keeps focus where it is, inside the control. Without this the browser moves focus to the
|
|
59
59
|
* page: the control loses its place for the keyboard, and a host that ends an edit on `blur`
|
|
60
60
|
* (a table cell editor) ends it in the middle of choosing. Presses on controls are untouched. */
|
|
61
|
-
holdFocus: (e: MouseEvent) => void;
|
|
61
|
+
holdFocus: (e: MouseEvent, boundary?: EventTarget | null) => void;
|
|
62
62
|
handleCalendarButtonClick: (e: MouseEvent) => void;
|
|
63
63
|
/** Turns the typed text into the value. Empty text clears it; unreadable text also clears it and
|
|
64
64
|
* reports `badInput` while the text stays to be fixed (the native date input does the same). */
|
|
@@ -33,9 +33,9 @@ var DateTextController = class {
|
|
|
33
33
|
if (input && root && root.activeElement !== input) input.focus();
|
|
34
34
|
this.open(false);
|
|
35
35
|
};
|
|
36
|
-
this.holdFocus = (e) => {
|
|
36
|
+
this.holdFocus = (e, boundary = e.currentTarget) => {
|
|
37
37
|
for (const node of e.composedPath()) {
|
|
38
|
-
if (node ===
|
|
38
|
+
if (node === boundary) break;
|
|
39
39
|
if (node instanceof HTMLElement && (node.tabIndex >= 0 || node.matches("button, input, select, textarea"))) return;
|
|
40
40
|
}
|
|
41
41
|
e.preventDefault();
|
|
@@ -5,6 +5,7 @@ import { Locale } from "../../utilities/Locale.js";
|
|
|
5
5
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
6
6
|
import { UNATTENDED_IDLE_MS } from "../../utilities/unattended.js";
|
|
7
7
|
import { styles } from "./UCarousel.styles.js";
|
|
8
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html, nothing } from "lit";
|
|
@@ -227,7 +228,7 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
227
228
|
appearance="plain"
|
|
228
229
|
rounded
|
|
229
230
|
aria-label=${Locale.getValue("previousSlide")}
|
|
230
|
-
|
|
231
|
+
${delegate("click", this.prev)}>
|
|
231
232
|
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
232
233
|
</u-button>
|
|
233
234
|
<u-button part="next-button" class="nav-button next"
|
|
@@ -235,7 +236,7 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
235
236
|
appearance="plain"
|
|
236
237
|
rounded
|
|
237
238
|
aria-label=${Locale.getValue("nextSlide")}
|
|
238
|
-
|
|
239
|
+
${delegate("click", this.next)}>
|
|
239
240
|
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
240
241
|
</u-button>
|
|
241
242
|
|
|
@@ -5,6 +5,7 @@ import "../tooltip/UTooltip.js";
|
|
|
5
5
|
import { UElement } from "../UElement.js";
|
|
6
6
|
import { styles } from "./UChip.styles.js";
|
|
7
7
|
import { Locale } from "../../utilities/Locale.js";
|
|
8
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html } from "lit";
|
|
@@ -47,7 +48,7 @@ var UChip = class UChip extends UElement {
|
|
|
47
48
|
.appearance=${this.appearance}
|
|
48
49
|
.color=${this.color}
|
|
49
50
|
.rounded=${this.rounded}
|
|
50
|
-
|
|
51
|
+
${delegate("click", this.handleTagClick)}
|
|
51
52
|
>
|
|
52
53
|
<u-icon class="check-icon" part="check" slot="prefix"
|
|
53
54
|
?hidden=${!this.selectable || !this.selected}
|
|
@@ -64,7 +65,7 @@ var UChip = class UChip extends UElement {
|
|
|
64
65
|
rounded
|
|
65
66
|
appearance="plain"
|
|
66
67
|
aria-label=${Locale.getValue("remove")}
|
|
67
|
-
|
|
68
|
+
${delegate("click", this.handleRemoveClick)}>
|
|
68
69
|
<u-icon lib="internal" name="x"></u-icon>
|
|
69
70
|
</u-button>
|
|
70
71
|
</u-tag>
|
|
@@ -4,6 +4,7 @@ import { UOverlayElement } from "../UOverlayElement.js";
|
|
|
4
4
|
import { styles } from "./UCommandPalette.styles.js";
|
|
5
5
|
import { Locale } from "../../utilities/Locale.js";
|
|
6
6
|
import { isImeComposing } from "../../utilities/keyboard.js";
|
|
7
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
7
8
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
8
9
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
9
10
|
import { html, nothing } from "lit";
|
|
@@ -164,7 +165,7 @@ var UCommandPalette = class UCommandPalette extends UOverlayElement {
|
|
|
164
165
|
@pointermove=${() => {
|
|
165
166
|
if (this.activeKey !== row.key) this.activeKey = row.key;
|
|
166
167
|
}}
|
|
167
|
-
|
|
168
|
+
${delegate("click", () => this.choose(row))}>
|
|
168
169
|
${item.icon ? html`<u-icon class="option-icon" lib=${ifDefined(item.iconLib)} name=${item.icon} aria-hidden="true"></u-icon>` : nothing}
|
|
169
170
|
<span class="option-label">${item.label}</span>
|
|
170
171
|
${item.description ? html`<span class="option-description" id=${ifDefined(descId)}>${item.description}</span>` : nothing}
|
|
@@ -4,6 +4,7 @@ import "../icon/UIcon.js";
|
|
|
4
4
|
import { UElement } from "../UElement.js";
|
|
5
5
|
import { styles } from "./UCopyButton.styles.js";
|
|
6
6
|
import { Locale } from "../../utilities/Locale.js";
|
|
7
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
7
8
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
8
9
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
9
10
|
import { html } from "lit";
|
|
@@ -62,7 +63,7 @@ var UCopyButton = class UCopyButton extends UElement {
|
|
|
62
63
|
?disabled=${this.disabled}
|
|
63
64
|
.appearance=${this.appearance}
|
|
64
65
|
.rounded=${this.rounded}
|
|
65
|
-
|
|
66
|
+
${delegate("click", this.handleButtonClick)}
|
|
66
67
|
>
|
|
67
68
|
<u-icon slot="prefix" part="icon" lib="internal" name=${iconName}></u-icon>
|
|
68
69
|
${this.label}
|
|
@@ -79,7 +80,7 @@ var UCopyButton = class UCopyButton extends UElement {
|
|
|
79
80
|
lib="internal"
|
|
80
81
|
name=${iconName}
|
|
81
82
|
aria-label=${this.copied ? Locale.getValue("copied") : Locale.getValue("copy")}
|
|
82
|
-
|
|
83
|
+
${delegate("click", this.handleButtonClick)}
|
|
83
84
|
>
|
|
84
85
|
<slot></slot>
|
|
85
86
|
</u-icon-button>
|
|
@@ -12,6 +12,7 @@ import { isDayUnavailable, parseISODate, toISODate } from "../calendar/dates.js"
|
|
|
12
12
|
import { normalizeTime, sameDateTime, splitDateTime, toDateTimeOffset } from "../calendar/datetime.js";
|
|
13
13
|
import { styles } from "../calendar/picker.styles.js";
|
|
14
14
|
import { styles as styles$1 } from "./UDatePicker.styles.js";
|
|
15
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
15
16
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
16
17
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
17
18
|
import { html } from "lit";
|
|
@@ -192,7 +193,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
192
193
|
.descriptionDisplay=${this.descriptionDisplay}
|
|
193
194
|
.validationMessage=${this.validationMessage}
|
|
194
195
|
>
|
|
195
|
-
<div class="container" part="container"
|
|
196
|
+
<div class="container" part="container" ${delegate("click", this.textEntry.handleContainerClick)}
|
|
196
197
|
style=${`--_icons: ${this.suffixButtonCount()}${chars ? `; --date-picker-min-text: ${chars}` : ""}`}>
|
|
197
198
|
<input class="text-input" part="input"
|
|
198
199
|
style=${ifDefined(chars ? `inline-size: ${chars}` : void 0)}
|
|
@@ -221,7 +222,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
221
222
|
aria-label=${Locale.getValue("clear")}
|
|
222
223
|
lib="internal"
|
|
223
224
|
name="x"
|
|
224
|
-
|
|
225
|
+
${delegate("click", this.handleClearClick)}
|
|
225
226
|
@keydown=${this.handleClearKeydown}
|
|
226
227
|
></u-icon>
|
|
227
228
|
<u-icon class="suffix-item calendar-button"
|
|
@@ -231,7 +232,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
231
232
|
?hidden=${this.effectivelyDisabled || this.readonly}
|
|
232
233
|
lib="internal"
|
|
233
234
|
name="calendar"
|
|
234
|
-
|
|
235
|
+
${delegate("click", this.textEntry.handleCalendarButtonClick)}
|
|
235
236
|
></u-icon>
|
|
236
237
|
</div>
|
|
237
238
|
</u-field>
|
|
@@ -254,7 +255,7 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
254
255
|
}
|
|
255
256
|
renderCalendar() {
|
|
256
257
|
return html`
|
|
257
|
-
<div class="calendar" part="calendar"
|
|
258
|
+
<div class="calendar" part="calendar" ${delegate("mousedown", this.textEntry.holdFocus)}>
|
|
258
259
|
<u-calendar
|
|
259
260
|
exportparts="calendar-header, calendar-title, calendar-weekdays, calendar-grid, calendar-week, day"
|
|
260
261
|
.value=${this.working ? toISODate(splitValue(this.working).date) : void 0}
|
|
@@ -287,14 +288,14 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
287
288
|
const todayDisabled = this.unavailable(/* @__PURE__ */ new Date());
|
|
288
289
|
return html`
|
|
289
290
|
<div class="calendar-footer" part="calendar-footer">
|
|
290
|
-
<u-button appearance="plain" size="sm" ?disabled=${todayDisabled}
|
|
291
|
+
<u-button appearance="plain" size="sm" ?disabled=${todayDisabled} ${delegate("click", this.handleTodayClick)}>${Locale.getValue("today")}</u-button>
|
|
291
292
|
${this.clearable && this.working ? html`
|
|
292
|
-
<u-button appearance="plain" size="sm"
|
|
293
|
+
<u-button appearance="plain" size="sm" ${delegate("click", this.handleFooterResetClick)}>${Locale.getValue("clear")}</u-button>
|
|
293
294
|
` : ""}
|
|
294
295
|
${this.confirm ? html`
|
|
295
296
|
<span class="confirm-actions">
|
|
296
|
-
<u-button appearance="plain" size="sm"
|
|
297
|
-
<u-button size="sm"
|
|
297
|
+
<u-button appearance="plain" size="sm" ${delegate("click", this.handleCancelClick)}>${Locale.getValue("cancel")}</u-button>
|
|
298
|
+
<u-button size="sm" ${delegate("click", this.handleApplyClick)}>${Locale.getValue("apply")}</u-button>
|
|
298
299
|
</span>
|
|
299
300
|
` : ""}
|
|
300
301
|
</div>
|
|
@@ -14,6 +14,7 @@ import { styles } from "../calendar/picker.styles.js";
|
|
|
14
14
|
import { devWarnOnce } from "../../utilities/devWarning.js";
|
|
15
15
|
import { resolvePresets } from "./presets.js";
|
|
16
16
|
import { styles as styles$1 } from "./UDateRangePicker.styles.js";
|
|
17
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
17
18
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
18
19
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
19
20
|
import { html } from "lit";
|
|
@@ -249,7 +250,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
|
|
|
249
250
|
.descriptionDisplay=${this.descriptionDisplay}
|
|
250
251
|
.validationMessage=${this.validationMessage}
|
|
251
252
|
>
|
|
252
|
-
<div class="container" part="container"
|
|
253
|
+
<div class="container" part="container" ${delegate("click", this.textEntry.handleContainerClick)}
|
|
253
254
|
style=${`--_icons: ${this.suffixButtonCount()}${chars ? `; --date-range-picker-min-text: ${chars}` : ""}`}>
|
|
254
255
|
<input class="text-input" part="input"
|
|
255
256
|
style=${ifDefined(width ? `inline-size: ${width}` : void 0)}
|
|
@@ -277,7 +278,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
|
|
|
277
278
|
aria-label=${Locale.getValue("clear")}
|
|
278
279
|
lib="internal"
|
|
279
280
|
name="x"
|
|
280
|
-
|
|
281
|
+
${delegate("click", this.handleClearClick)}
|
|
281
282
|
@keydown=${this.handleClearKeydown}
|
|
282
283
|
></u-icon>
|
|
283
284
|
<u-icon class="suffix-item calendar-button"
|
|
@@ -287,7 +288,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
|
|
|
287
288
|
?hidden=${this.effectivelyDisabled || this.readonly}
|
|
288
289
|
lib="internal"
|
|
289
290
|
name="calendar"
|
|
290
|
-
|
|
291
|
+
${delegate("click", this.textEntry.handleCalendarButtonClick)}
|
|
291
292
|
></u-icon>
|
|
292
293
|
</div>
|
|
293
294
|
</u-field>
|
|
@@ -316,7 +317,7 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
|
|
|
316
317
|
return html`
|
|
317
318
|
<div class="body">
|
|
318
319
|
${presets.length ? this.renderPresets(presets) : ""}
|
|
319
|
-
<div class="calendar" part="calendar"
|
|
320
|
+
<div class="calendar" part="calendar" ${delegate("mousedown", this.textEntry.holdFocus)}>
|
|
320
321
|
<u-calendar
|
|
321
322
|
exportparts="calendar-month, calendar-header, calendar-title, calendar-weekdays, calendar-grid, calendar-week, day"
|
|
322
323
|
selection="range"
|
|
@@ -333,12 +334,12 @@ var UDateRangePicker = class UDateRangePicker extends UFormControlElement {
|
|
|
333
334
|
${showClear || this.confirm ? html`
|
|
334
335
|
<div class="calendar-footer" part="calendar-footer">
|
|
335
336
|
${showClear ? html`
|
|
336
|
-
<u-button appearance="plain" size="sm"
|
|
337
|
+
<u-button appearance="plain" size="sm" ${delegate("click", this.handleFooterResetClick)}>${Locale.getValue("clear")}</u-button>
|
|
337
338
|
` : ""}
|
|
338
339
|
${this.confirm ? html`
|
|
339
340
|
<span class="confirm-actions">
|
|
340
|
-
<u-button appearance="plain" size="sm"
|
|
341
|
-
<u-button size="sm"
|
|
341
|
+
<u-button appearance="plain" size="sm" ${delegate("click", this.handleCancelClick)}>${Locale.getValue("cancel")}</u-button>
|
|
342
|
+
<u-button size="sm" ${delegate("click", this.handleApplyClick)}>${Locale.getValue("apply")}</u-button>
|
|
342
343
|
</span>
|
|
343
344
|
` : ""}
|
|
344
345
|
</div>
|
|
@@ -3,6 +3,7 @@ import "../icon/UIcon.js";
|
|
|
3
3
|
import { UOverlayElement } from "../UOverlayElement.js";
|
|
4
4
|
import { styles } from "./UDialog.styles.js";
|
|
5
5
|
import { Locale } from "../../utilities/Locale.js";
|
|
6
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
6
7
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
7
8
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
8
9
|
import { html } from "lit";
|
|
@@ -36,7 +37,7 @@ var UDialog = class UDialog extends UOverlayElement {
|
|
|
36
37
|
appearance="plain"
|
|
37
38
|
?hidden=${!this.closable}
|
|
38
39
|
aria-label=${Locale.getValue("close")}
|
|
39
|
-
|
|
40
|
+
${delegate("click", () => this.requestClose("button"))}>
|
|
40
41
|
<u-icon lib="internal" name="x"></u-icon>
|
|
41
42
|
</u-button>
|
|
42
43
|
</div>
|
|
@@ -3,6 +3,7 @@ import "../icon/UIcon.js";
|
|
|
3
3
|
import { UOverlayElement } from "../UOverlayElement.js";
|
|
4
4
|
import { styles } from "./UDrawer.styles.js";
|
|
5
5
|
import { Locale } from "../../utilities/Locale.js";
|
|
6
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
6
7
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
7
8
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
8
9
|
import { html } from "lit";
|
|
@@ -29,7 +30,7 @@ var UDrawer = class UDrawer extends UOverlayElement {
|
|
|
29
30
|
appearance="plain"
|
|
30
31
|
?hidden=${!this.closable}
|
|
31
32
|
aria-label=${Locale.getValue("close")}
|
|
32
|
-
|
|
33
|
+
${delegate("click", () => this.requestClose("button"))}>
|
|
33
34
|
<u-icon lib="internal" name="x"></u-icon>
|
|
34
35
|
</u-button>
|
|
35
36
|
</div>
|
|
@@ -4,6 +4,7 @@ import { HostAria } from "../../utilities/hostAria.js";
|
|
|
4
4
|
import { styles } from "./UField.styles.js";
|
|
5
5
|
import "../icon/UIcon.js";
|
|
6
6
|
import "../tooltip/UTooltip.js";
|
|
7
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
7
8
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
8
9
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
9
10
|
import { html, nothing } from "lit";
|
|
@@ -152,7 +153,7 @@ var UField = class UField extends UElement {
|
|
|
152
153
|
render() {
|
|
153
154
|
return html`
|
|
154
155
|
<div class="header" part="header" ?hidden=${!this.label}>
|
|
155
|
-
<label class="label" part="label"
|
|
156
|
+
<label class="label" part="label" ${delegate("click", this.handleLabelClick)}>
|
|
156
157
|
<span class="required" part="required" ?hidden=${!this.required}>*</span>
|
|
157
158
|
${this.label}
|
|
158
159
|
</label>
|
|
@@ -179,7 +180,7 @@ var UField = class UField extends UElement {
|
|
|
179
180
|
return html`
|
|
180
181
|
<span class="hint" part="hint" aria-hidden="true"
|
|
181
182
|
@pointerdown=${this.handleHintPointerDown}
|
|
182
|
-
|
|
183
|
+
${delegate("click", this.handleHintClick)}>
|
|
183
184
|
<u-icon lib="internal" name="info-circle-fill"></u-icon>
|
|
184
185
|
<u-tooltip part="hint-tooltip" placement="top-start" shift>${this.description}</u-tooltip>
|
|
185
186
|
</span>
|
|
@@ -3,6 +3,7 @@ import "../icon/UIcon.js";
|
|
|
3
3
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
4
4
|
import { Locale } from "../../utilities/Locale.js";
|
|
5
5
|
import { styles } from "./UFileInput.styles.js";
|
|
6
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
6
7
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
7
8
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
8
9
|
import { html } from "lit";
|
|
@@ -130,7 +131,7 @@ var UFileInput = class UFileInput extends UFormControlElement {
|
|
|
130
131
|
aria-label=${Locale.getValue("clear")}
|
|
131
132
|
lib="internal"
|
|
132
133
|
name="x"
|
|
133
|
-
|
|
134
|
+
${delegate("click", this.handleClearButtonClick)}
|
|
134
135
|
@keydown=${this.handleClearButtonKeydown}
|
|
135
136
|
></u-icon>
|
|
136
137
|
|
|
@@ -10,6 +10,7 @@ import "../popover/UPopover.js";
|
|
|
10
10
|
import { styles } from "./UInput.styles.js";
|
|
11
11
|
import { isImeComposing } from "../../utilities/keyboard.js";
|
|
12
12
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
13
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
13
14
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
14
15
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
15
16
|
import { html } from "lit";
|
|
@@ -254,7 +255,7 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
254
255
|
aria-label=${Locale.getValue(this.showPassword ? "hidePassword" : "showPassword")}
|
|
255
256
|
lib="internal"
|
|
256
257
|
name=${this.showPassword ? "eye-off" : "eye"}
|
|
257
|
-
|
|
258
|
+
${delegate("click", this.handlePasswordTogglerClick)}
|
|
258
259
|
@keydown=${this.handleSuffixIconKeydown(this.handlePasswordTogglerClick)}
|
|
259
260
|
></u-icon>
|
|
260
261
|
<u-icon class="suffix-item"
|
|
@@ -264,7 +265,7 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
264
265
|
aria-label=${Locale.getValue("clear")}
|
|
265
266
|
lib="internal"
|
|
266
267
|
name="x"
|
|
267
|
-
|
|
268
|
+
${delegate("click", this.handleClearButtonClick)}
|
|
268
269
|
@keydown=${this.handleSuffixIconKeydown(this.handleClearButtonClick)}
|
|
269
270
|
></u-icon>
|
|
270
271
|
<u-icon class="suffix-item stepper-btn"
|
|
@@ -275,7 +276,7 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
275
276
|
aria-label=${Locale.getValue("decrement")}
|
|
276
277
|
lib="internal"
|
|
277
278
|
name="minus"
|
|
278
|
-
|
|
279
|
+
${delegate("click", this.handleStepperClick(-1))}
|
|
279
280
|
@keydown=${this.handleSuffixIconKeydown(this.handleStepperClick(-1))}
|
|
280
281
|
></u-icon>
|
|
281
282
|
<u-icon class="suffix-item stepper-btn"
|
|
@@ -286,7 +287,7 @@ var UInput = class UInput extends UFormControlElement {
|
|
|
286
287
|
aria-label=${Locale.getValue("increment")}
|
|
287
288
|
lib="internal"
|
|
288
289
|
name="plus"
|
|
289
|
-
|
|
290
|
+
${delegate("click", this.handleStepperClick(1))}
|
|
290
291
|
@keydown=${this.handleSuffixIconKeydown(this.handleStepperClick(1))}
|
|
291
292
|
></u-icon>
|
|
292
293
|
</div>
|
|
@@ -6,6 +6,7 @@ import { styles } from "./UMenuItem.styles.js";
|
|
|
6
6
|
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
7
7
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
8
8
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
9
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
9
10
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
10
11
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
11
12
|
import { html } from "lit";
|
|
@@ -98,7 +99,7 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
98
99
|
render() {
|
|
99
100
|
return html`
|
|
100
101
|
<div class="header" part="header"
|
|
101
|
-
|
|
102
|
+
${delegate("click", this.handleHeaderClick)}
|
|
102
103
|
>
|
|
103
104
|
<u-icon class="prefix-checker"
|
|
104
105
|
?hidden=${this.indicator !== "check" || !this.selected}
|
|
@@ -5,6 +5,7 @@ import "../option/UOption.js";
|
|
|
5
5
|
import { UElement } from "../UElement.js";
|
|
6
6
|
import { Locale } from "../../utilities/Locale.js";
|
|
7
7
|
import { styles } from "./UPagination.styles.js";
|
|
8
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html, nothing } from "lit";
|
|
@@ -59,18 +60,18 @@ var UPagination = class UPagination extends UElement {
|
|
|
59
60
|
<u-button part="prev" class="step" appearance="plain" size=${this.size}
|
|
60
61
|
aria-label=${Locale.getValue("previousPage")}
|
|
61
62
|
?disabled=${current <= 0}
|
|
62
|
-
|
|
63
|
+
${delegate("click", () => this.go(current - 1))}>
|
|
63
64
|
<u-icon lib="internal" name="chevron-left"></u-icon>
|
|
64
65
|
</u-button>
|
|
65
66
|
${this.cells(current, last).map((cell) => cell === "gap" ? html`<span class="gap" aria-hidden="true">…</span>` : html`<u-button part="page" class="page" size=${this.size}
|
|
66
67
|
appearance=${cell === current ? "soft" : "plain"}
|
|
67
68
|
aria-label=${Locale.getValue("pageN", { n: cell + 1 })}
|
|
68
69
|
aria-current=${cell === current ? "page" : nothing}
|
|
69
|
-
|
|
70
|
+
${delegate("click", () => this.go(cell))}>${cell + 1}</u-button>`)}
|
|
70
71
|
<u-button part="next" class="step" appearance="plain" size=${this.size}
|
|
71
72
|
aria-label=${Locale.getValue("nextPage")}
|
|
72
73
|
?disabled=${current >= last}
|
|
73
|
-
|
|
74
|
+
${delegate("click", () => this.go(current + 1))}>
|
|
74
75
|
<u-icon lib="internal" name="chevron-right"></u-icon>
|
|
75
76
|
</u-button>
|
|
76
77
|
</div>
|
|
@@ -44,6 +44,7 @@ export declare class UPopover extends UFloatingElement {
|
|
|
44
44
|
render(): import('lit-html').TemplateResult<1>;
|
|
45
45
|
focusTo(index: number): void;
|
|
46
46
|
private bind;
|
|
47
|
+
private anchorClickStops;
|
|
47
48
|
private unbind;
|
|
48
49
|
private handleAnchorClick;
|
|
49
50
|
private handleAnchorKeydown;
|
|
@@ -42,9 +42,10 @@ var UPopover = class UPopover extends UFloatingElement {
|
|
|
42
42
|
"resize"
|
|
43
43
|
];
|
|
44
44
|
this.dismissEvent = [];
|
|
45
|
-
this.
|
|
45
|
+
this.anchorClickStops = [];
|
|
46
|
+
this.handleAnchorClick = (anchor) => {
|
|
46
47
|
if (this.open) this.hide();
|
|
47
|
-
else this.show(
|
|
48
|
+
else this.show(anchor);
|
|
48
49
|
};
|
|
49
50
|
this.handleAnchorKeydown = (e) => {
|
|
50
51
|
if (![
|
|
@@ -183,7 +184,12 @@ var UPopover = class UPopover extends UFloatingElement {
|
|
|
183
184
|
switch (this.trigger) {
|
|
184
185
|
case "click":
|
|
185
186
|
for (const anchor of anchors) {
|
|
186
|
-
anchor.
|
|
187
|
+
const root = anchor.getRootNode();
|
|
188
|
+
const listener = (e) => {
|
|
189
|
+
if (e.composedPath().includes(anchor)) this.handleAnchorClick(anchor);
|
|
190
|
+
};
|
|
191
|
+
root.addEventListener("click", listener);
|
|
192
|
+
this.anchorClickStops.push(() => root.removeEventListener("click", listener));
|
|
187
193
|
anchor.addEventListener("keydown", this.handleAnchorKeydown);
|
|
188
194
|
}
|
|
189
195
|
break;
|
|
@@ -215,8 +221,8 @@ var UPopover = class UPopover extends UFloatingElement {
|
|
|
215
221
|
for (const eventName of dismissEventList) this.addEventListener(eventName, this.handlePopoverEvent);
|
|
216
222
|
}
|
|
217
223
|
unbind(anchors) {
|
|
224
|
+
for (const stop of this.anchorClickStops.splice(0)) stop();
|
|
218
225
|
for (const anchor of anchors) {
|
|
219
|
-
anchor.removeEventListener("click", this.handleAnchorClick);
|
|
220
226
|
anchor.removeEventListener("keydown", this.handleAnchorKeydown);
|
|
221
227
|
anchor.removeEventListener("pointerenter", this.handleAnchorPointerEnter);
|
|
222
228
|
anchor.removeEventListener("pointerleave", this.handleAnchorPointerLeave);
|
|
@@ -3,6 +3,7 @@ import "../icon/UIcon.js";
|
|
|
3
3
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
4
4
|
import { Locale } from "../../utilities/Locale.js";
|
|
5
5
|
import { styles } from "./URating.styles.js";
|
|
6
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
6
7
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
7
8
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
8
9
|
import { html } from "lit";
|
|
@@ -34,10 +35,10 @@ var URating = class URating extends UFormControlElement {
|
|
|
34
35
|
if (this.effectivelyDisabled || this.readonly) return;
|
|
35
36
|
this.buffer = -1;
|
|
36
37
|
};
|
|
37
|
-
this.handleSymbolClick = (e) => {
|
|
38
|
+
this.handleSymbolClick = (e, symbol) => {
|
|
38
39
|
if (this.effectivelyDisabled || this.readonly) return;
|
|
39
|
-
const score = Number(
|
|
40
|
-
const val = this.precision < 1 ? this.calibrate(e, score) : score;
|
|
40
|
+
const score = Number(symbol.dataset.score);
|
|
41
|
+
const val = this.precision < 1 ? this.calibrate(e, score, symbol) : score;
|
|
41
42
|
const next = this.value === val ? 0 : val;
|
|
42
43
|
if (next === this.value) return;
|
|
43
44
|
this.value = next;
|
|
@@ -134,7 +135,7 @@ var URating = class URating extends UFormControlElement {
|
|
|
134
135
|
data-score=${score}
|
|
135
136
|
@pointermove=${this.handleSymbolPointerMove}
|
|
136
137
|
@pointerleave=${this.handleSymbolPointerLeave}
|
|
137
|
-
|
|
138
|
+
${delegate("click", this.handleSymbolClick)}
|
|
138
139
|
@keydown=${this.handleSymbolKeydown}
|
|
139
140
|
>
|
|
140
141
|
${this.symbolOff ? this.symbolOff.cloneNode(true) : html`<u-icon lib="internal" name="star"></u-icon>`}
|
|
@@ -217,8 +218,8 @@ var URating = class URating extends UFormControlElement {
|
|
|
217
218
|
composed: true
|
|
218
219
|
}));
|
|
219
220
|
}
|
|
220
|
-
calibrate(e, score) {
|
|
221
|
-
const rect =
|
|
221
|
+
calibrate(e, score, symbol = e.currentTarget) {
|
|
222
|
+
const rect = symbol.getBoundingClientRect();
|
|
222
223
|
const ratio = Math.max(0, Math.min(1, (e.clientX - rect.left) / rect.width));
|
|
223
224
|
const raw = score - 1 + ratio;
|
|
224
225
|
const p = Math.max(.01, Math.min(1, this.precision));
|
|
@@ -11,6 +11,7 @@ import { UOptionGroup, collectOptions } from "../option-group/UOptionGroup.js";
|
|
|
11
11
|
import "../popover/UPopover.js";
|
|
12
12
|
import { styles } from "./USelect.styles.js";
|
|
13
13
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
14
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
14
15
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
15
16
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
16
17
|
import { html, nothing } from "lit";
|
|
@@ -275,7 +276,7 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
275
276
|
aria-haspopup=${ifDefined(this.searchable ? void 0 : "listbox")}
|
|
276
277
|
aria-expanded=${ifDefined(this.searchable ? void 0 : String(this.open))}
|
|
277
278
|
aria-controls=${ifDefined(this.searchable ? void 0 : this.listboxId)}
|
|
278
|
-
|
|
279
|
+
${delegate("click", this.handleContainerClick)}
|
|
279
280
|
@keydown=${this.handleTriggerKeydown}>
|
|
280
281
|
<span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
|
|
281
282
|
<div class="value-area">
|
|
@@ -311,7 +312,7 @@ var USelect = class USelect extends UFormControlElement {
|
|
|
311
312
|
aria-label=${Locale.getValue("clear")}
|
|
312
313
|
lib="internal"
|
|
313
314
|
name="x"
|
|
314
|
-
|
|
315
|
+
${delegate("click", this.handleClearClick)}
|
|
315
316
|
@keydown=${this.handleClearKeydown}
|
|
316
317
|
></u-icon>
|
|
317
318
|
<u-icon class="suffix-item"
|
|
@@ -5,6 +5,7 @@ import { styles } from "./UTab.styles.js";
|
|
|
5
5
|
import { Locale } from "../../utilities/Locale.js";
|
|
6
6
|
import { formatNumber } from "../../utilities/format.js";
|
|
7
7
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
8
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html, nothing } from "lit";
|
|
@@ -84,7 +85,7 @@ var UTab = class UTab extends UElement {
|
|
|
84
85
|
?hidden=${!this.removable}
|
|
85
86
|
appearance="plain"
|
|
86
87
|
aria-label=${Locale.getValue("closeTab")}
|
|
87
|
-
|
|
88
|
+
${delegate("click", this.handleRemoveClick)}
|
|
88
89
|
>
|
|
89
90
|
<u-icon lib="internal" name="x"></u-icon>
|
|
90
91
|
</u-button>
|
|
@@ -5,6 +5,7 @@ import { HostAria } from "../../utilities/hostAria.js";
|
|
|
5
5
|
import { styles } from "./UTreeItem.styles.js";
|
|
6
6
|
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
7
7
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
8
|
+
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html } from "lit";
|
|
@@ -126,11 +127,11 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
126
127
|
return html`
|
|
127
128
|
<div class="header" part="header"
|
|
128
129
|
?selected=${this.selected}
|
|
129
|
-
|
|
130
|
+
${delegate("click", this.handleHeaderClick)}
|
|
130
131
|
>
|
|
131
132
|
<span class="prefix-toggler"
|
|
132
133
|
?hidden=${this.leaf}
|
|
133
|
-
|
|
134
|
+
${delegate("click", this.handleToggleClick)}
|
|
134
135
|
>
|
|
135
136
|
${this.loading ? html`<u-spinner></u-spinner>` : this.expanded ? this.collapseIcon || html`<u-icon lib="internal" name="chevron-down"></u-icon>` : this.expandIcon || html`<u-icon lib="internal" name="chevron-right"></u-icon>`}
|
|
136
137
|
</span>
|
|
@@ -139,7 +140,7 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
139
140
|
?hidden=${!this.checkable}
|
|
140
141
|
?checked=${this.checked}
|
|
141
142
|
?indeterminate=${this.indeterminate}
|
|
142
|
-
|
|
143
|
+
${delegate("click", this.handleCheckboxClick)}
|
|
143
144
|
>
|
|
144
145
|
<u-icon lib="internal"
|
|
145
146
|
name=${this.indeterminate ? "minus" : "check"}
|
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export * from './utilities/dateValue.js';
|
|
|
71
71
|
export * from './utilities/devWarning.js';
|
|
72
72
|
export * from './utilities/Dialog.js';
|
|
73
73
|
export * from './utilities/elements.js';
|
|
74
|
+
export * from './utilities/listenInShadow.js';
|
|
74
75
|
export * from './utilities/format.js';
|
|
75
76
|
export * from './utilities/numberFormat.js';
|
|
76
77
|
export * from './utilities/icons.js';
|
package/dist/index.js
CHANGED
|
@@ -62,6 +62,7 @@ import { localOffset, readDateValue, writeInstant, writePlainDate, writePlainDat
|
|
|
62
62
|
import { createDevWarner, devWarnOnce, resetDevWarnings } from "./utilities/devWarning.js";
|
|
63
63
|
import { Dialog } from "./utilities/Dialog.js";
|
|
64
64
|
import { getParentElement, isCoarsePointer, isFocusCandidate, isFromControl, querySelectorAllWithin, querySelectorDeep, querySelectorWithin } from "./utilities/elements.js";
|
|
65
|
+
import { delegate, listenInShadow } from "./utilities/listenInShadow.js";
|
|
65
66
|
import { dateTextPattern, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber } from "./utilities/format.js";
|
|
66
67
|
import { applyNumberFormat } from "./utilities/numberFormat.js";
|
|
67
68
|
import { IconCache, IconRegistry, getDefaultBaseUrl, setDefaultBaseUrl } from "./utilities/icons.js";
|
|
@@ -73,4 +74,4 @@ import { OverlayManager } from "./utilities/OverlayManager.js";
|
|
|
73
74
|
import { Theme } from "./utilities/Theme.js";
|
|
74
75
|
import { Toast } from "./utilities/Toast.js";
|
|
75
76
|
import { decodeDelimited, decodeTsv, encodeTsv } from "./utilities/tsv.js";
|
|
76
|
-
export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAutoScroll, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCommandPalette, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOptionGroup, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, applyNumberFormat, arrayAttrConverter, booleanAttrConverter, collectOptions, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, devWarnOnce, encodeTsv, filterCommands, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
|
|
77
|
+
export { ALERT_STATUSES, BrowserStorage, CompositionTracker, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAutoScroll, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCommandPalette, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOptionGroup, UOverlayElement, UPagination, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USteps, USwitch, UTab, UTabNav, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, applyNumberFormat, arrayAttrConverter, booleanAttrConverter, collectOptions, copyFromKey, createDevWarner, dateAttrConverter, dateTextPattern, decodeDelimited, decodeTsv, defaultSearchMatch, delegate, devWarnOnce, encodeTsv, filterCommands, foldForSearch, formatCurrency, formatDate, formatDateRange, formatDateRangeText, formatDateText, formatDateTimeRangeText, formatDateTimeText, formatNumber, getDefaultBaseUrl, getParentElement, hangulKeystrokes, initialsOf, isCoarsePointer, isFocusCandidate, isFromControl, isHangul, isImeComposing, isTextEntry, jsonAttrConverter, listenInShadow, localOffset, parseDate, parseDateRange, parseDateTime, parseDateTimeRange, parseNumber, pasteFromKey, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, readDateValue, replayInput, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter, writeInstant, writePlainDate, writePlainDateTime };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { directive } from 'lit/async-directive.js';
|
|
2
|
+
/**
|
|
3
|
+
* Listens on a shadow root for events from the elements of that root that match `selector`. The handler
|
|
4
|
+
* receives the event and the matched element. Returns a function that removes the listener.
|
|
5
|
+
*/
|
|
6
|
+
export declare function listenInShadow<E extends Event = Event>(root: ShadowRoot | HTMLElement, type: string, selector: string, handler: (event: E, matched: HTMLElement) => void, options?: AddEventListenerOptions): () => void;
|
|
7
|
+
/**
|
|
8
|
+
* An event handler for an element in a shadow tree, heard on that tree's root instead of on the element:
|
|
9
|
+
* `<div class="container" ${delegate('click', this.open)}>` in place of `@click=${this.open}`. Handlers run in
|
|
10
|
+
* bubbling order and `stopPropagation()` stops the ones further out, as with element listeners. The handler
|
|
11
|
+
* gets the element as its second argument and the component as `this`. A `null` or `undefined` handler listens to
|
|
12
|
+
* nothing, as with `@click=${undefined}`.
|
|
13
|
+
*/
|
|
14
|
+
export declare const delegate: <E extends Event = Event>(type: string, handler: ((event: E, element: HTMLElement) => void) | null | undefined) => ReturnType<ReturnType<typeof directive>>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { noChange, nothing } from "lit";
|
|
2
|
+
import { AsyncDirective, PartType, directive } from "lit/async-directive.js";
|
|
3
|
+
// src/utilities/listenInShadow.ts
|
|
4
|
+
/**
|
|
5
|
+
* Listens on a shadow root for events from the elements of that root that match `selector`. The handler
|
|
6
|
+
* receives the event and the matched element. Returns a function that removes the listener.
|
|
7
|
+
*/
|
|
8
|
+
function listenInShadow(root, type, selector, handler, options) {
|
|
9
|
+
const listener = (event) => {
|
|
10
|
+
for (const node of event.composedPath()) {
|
|
11
|
+
if (node === root) return;
|
|
12
|
+
if (node instanceof HTMLElement && node.getRootNode() === root && node.matches(selector)) {
|
|
13
|
+
handler(event, node);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
root.addEventListener(type, listener, options);
|
|
19
|
+
return () => root.removeEventListener(type, listener, options);
|
|
20
|
+
}
|
|
21
|
+
/** root → event type → element → handler. One listener per root and type, added the first time it is needed. */
|
|
22
|
+
var registry = /* @__PURE__ */ new WeakMap();
|
|
23
|
+
function register(root, type) {
|
|
24
|
+
let types = registry.get(root);
|
|
25
|
+
if (!types) registry.set(root, types = /* @__PURE__ */ new Map());
|
|
26
|
+
let handlers = types.get(type);
|
|
27
|
+
if (!handlers) {
|
|
28
|
+
const map = handlers = /* @__PURE__ */ new WeakMap();
|
|
29
|
+
types.set(type, map);
|
|
30
|
+
root.addEventListener(type, (event) => {
|
|
31
|
+
for (const node of event.composedPath()) {
|
|
32
|
+
if (node === root) return;
|
|
33
|
+
if (!(node instanceof Element)) continue;
|
|
34
|
+
const entry = map.get(node);
|
|
35
|
+
if (!entry) continue;
|
|
36
|
+
entry.handler.call(entry.host, event, node);
|
|
37
|
+
if (event.cancelBubble) return;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return handlers;
|
|
42
|
+
}
|
|
43
|
+
var DelegateDirective = class extends AsyncDirective {
|
|
44
|
+
constructor(part) {
|
|
45
|
+
super(part);
|
|
46
|
+
if (part.type !== PartType.ELEMENT) throw new Error("delegate() belongs in an element position");
|
|
47
|
+
}
|
|
48
|
+
render(_type, _handler) {
|
|
49
|
+
return nothing;
|
|
50
|
+
}
|
|
51
|
+
update(part, [type, handler]) {
|
|
52
|
+
const element = part.element;
|
|
53
|
+
if (this.element && this.type && (this.element !== element || this.type !== type || !handler)) this.forget();
|
|
54
|
+
if (!handler) {
|
|
55
|
+
this.element = void 0;
|
|
56
|
+
return noChange;
|
|
57
|
+
}
|
|
58
|
+
this.element = element;
|
|
59
|
+
this.type = type;
|
|
60
|
+
const host = part.options?.host;
|
|
61
|
+
const root = host?.renderRoot ?? element.getRootNode();
|
|
62
|
+
this.root = root;
|
|
63
|
+
register(root, type).set(element, {
|
|
64
|
+
handler,
|
|
65
|
+
host: host ?? element
|
|
66
|
+
});
|
|
67
|
+
return noChange;
|
|
68
|
+
}
|
|
69
|
+
disconnected() {
|
|
70
|
+
this.forget();
|
|
71
|
+
}
|
|
72
|
+
reconnected() {}
|
|
73
|
+
forget() {
|
|
74
|
+
if (!this.element || !this.type) return;
|
|
75
|
+
if (this.root) registry.get(this.root)?.get(this.type)?.delete(this.element);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* An event handler for an element in a shadow tree, heard on that tree's root instead of on the element:
|
|
80
|
+
* `<div class="container" ${delegate('click', this.open)}>` in place of `@click=${this.open}`. Handlers run in
|
|
81
|
+
* bubbling order and `stopPropagation()` stops the ones further out, as with element listeners. The handler
|
|
82
|
+
* gets the element as its second argument and the component as `this`. A `null` or `undefined` handler listens to
|
|
83
|
+
* nothing, as with `@click=${undefined}`.
|
|
84
|
+
*/
|
|
85
|
+
var delegate = directive(DelegateDirective);
|
|
86
|
+
export { delegate, listenInShadow };
|
package/package.json
CHANGED
|
@@ -153,6 +153,7 @@ set on the host yourself always wins and is never overwritten.
|
|
|
153
153
|
- [`clipboard`](./references/utilities/clipboard.md) — `copyFromKey` / `pasteFromKey` / `isTextEntry`, Ctrl/Cmd + C · X · V for a grid or list selection in every browser (Safari fires no copy event without a text selection)
|
|
154
154
|
- [`keyboard`](./references/utilities/keyboard.md) — `isImeComposing` for Enter handlers that must not fire mid-composition (Korean/Japanese/Chinese input) · `CompositionTracker` / `replayInput` for inputs that filter as you type
|
|
155
155
|
- [`tsv`](./references/utilities/tsv.md) — `encodeTsv` / `decodeTsv`, the spreadsheet clipboard format with RFC 4180 quoting
|
|
156
|
+
- [`listen-in-shadow`](./references/utilities/listen-in-shadow.md) — `delegate` / `listenInShadow`, handlers for shadow-tree parts heard on the shadow root, so screen readers do not announce those parts as «clickable»
|
|
156
157
|
- [`OverlayManager`](./references/utilities/overlay-manager.md) — Internal overlay stack and z-index manager
|
|
157
158
|
|
|
158
159
|
---
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# listen-in-shadow
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import { delegate, listenInShadow } from '@iyulab/components';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
Without the barrel's component registrations:
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { delegate, listenInShadow } from '@iyulab/components/dist/utilities/listenInShadow.js';
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Event handlers for the parts of a component's shadow tree, heard on the shadow root instead of on the part.
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
A `click`, `mousedown` or `mouseup` listener on an element makes the browser expose that element as clickable.
|
|
18
|
+
Screen readers announce it: NVDA says «clickable» on the element and when entering it, which covers everything
|
|
19
|
+
inside it. Measured with NVDA in browse mode:
|
|
20
|
+
|
|
21
|
+
| Listener on | Announced |
|
|
22
|
+
|---|---|
|
|
23
|
+
| an element whose role is button, link, menuitem, tab, option, radio, checkbox or switch | nothing extra |
|
|
24
|
+
| any other element (a label, a container, a grid cell, a tree item, a custom element's host) | «clickable» |
|
|
25
|
+
| the shadow root | nothing |
|
|
26
|
+
| `pointerdown` on any element | nothing |
|
|
27
|
+
|
|
28
|
+
So a convenience handler (a label that focuses its control, a field container that opens a calendar, a cell that
|
|
29
|
+
selects its row) belongs on the shadow root.
|
|
30
|
+
|
|
31
|
+
## `delegate(type, handler)` — in a Lit template
|
|
32
|
+
|
|
33
|
+
An element directive used in place of `@click`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { html, LitElement } from 'lit';
|
|
37
|
+
import { delegate } from '@iyulab/components';
|
|
38
|
+
|
|
39
|
+
class MyField extends LitElement {
|
|
40
|
+
render() {
|
|
41
|
+
return html`
|
|
42
|
+
<label class="label" ${delegate('click', this.focusControl)}>Name</label>
|
|
43
|
+
<div class="cell" data-row="3" ${delegate<MouseEvent>('click', (e, cell) => this.select(Number(cell.dataset.row)))}></div>
|
|
44
|
+
`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private focusControl = () => { /* … */ };
|
|
48
|
+
private select(row: number) { /* … */ }
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
- The handler receives the event and the element it was written on; `this` is the component.
|
|
53
|
+
- Handlers on nested elements run innermost first, like element listeners, and `stopPropagation()` in one stops
|
|
54
|
+
the ones further out.
|
|
55
|
+
- `event.currentTarget` is the shadow root, not the element — use the second argument.
|
|
56
|
+
- A `null` or `undefined` handler listens to nothing: `${delegate('click', sortable ? this.sort : undefined)}`.
|
|
57
|
+
- Delegated handlers run when the event reaches the shadow root. An element listener on an ancestor inside the same
|
|
58
|
+
tree (a native `<button>` with `@click`) runs before them, so a delegated handler inside it cannot
|
|
59
|
+
`stopPropagation()` that listener. Keep such an inner handler on its element — the children of a button are
|
|
60
|
+
presentational, so it is not announced.
|
|
61
|
+
|
|
62
|
+
## `listenInShadow(root, type, selector, handler)` — imperative
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
const stop = listenInShadow<MouseEvent>(this.shadowRoot!, 'click', '.label', (e, label) => { /* … */ });
|
|
66
|
+
// later
|
|
67
|
+
stop();
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Calls `handler` for the first element of `root` on the event's path that matches `selector`. Returns a function
|
|
71
|
+
that removes the listener.
|
|
72
|
+
|
|
73
|
+
## Hosts
|
|
74
|
+
|
|
75
|
+
A listener on a host makes the host and its whole shadow tree «clickable» — including the button inside a
|
|
76
|
+
button component. `u-button` therefore sets `role="none"` on its host (unless you give it a role), so your
|
|
77
|
+
`addEventListener('click', …)` on a `u-button` is not announced. A host that carries `aria-label` (or another
|
|
78
|
+
global ARIA attribute) cannot be presentational — browsers ignore `role="none"` then — so a listener on such a
|
|
79
|
+
host is still announced.
|