@iyulab/components 2.23.0 → 2.23.1
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 +9 -0
- package/dist/components/UOverlayElement.d.ts +8 -1
- package/dist/components/UOverlayElement.js +14 -4
- package/dist/utilities/elements.d.ts +2 -1
- package/dist/utilities/elements.js +3 -2
- package/package.json +1 -1
- package/skills/iyulab-components/references/components/field.md +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.23.1] - 2026-10-13
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- A `u-dialog` or `u-drawer` whose controls are components — `u-button`, `u-icon-button` — gives the first of them the
|
|
8
|
+
focus when it opens. The focus stayed on the dialog itself: the initial-focus search did not count a host whose
|
|
9
|
+
shadow root delegates focus as focusable, and the trap's own «first tabbable» did not see inside it at that moment
|
|
10
|
+
(a native `<button>` was found). `autofocus` on a `u-icon-button` is honoured for the same reason.
|
|
11
|
+
|
|
3
12
|
## [2.23.0] - 2026-10-13
|
|
4
13
|
|
|
5
14
|
### Added
|
|
@@ -82,7 +82,12 @@ export declare abstract class UOverlayElement extends UElement {
|
|
|
82
82
|
/**
|
|
83
83
|
* 열릴 때 포커스를 받을 요소를 정한다 — **입력을 먼저 본다.**
|
|
84
84
|
*
|
|
85
|
-
* 순서: `[autofocus]` → 첫 입력 컨트롤 → (없으면) focus-trap
|
|
85
|
+
* 순서: `[autofocus]` → 첫 입력 컨트롤 → 첫 포커스 가능 요소(섀도 안까지) → (없으면) focus-trap 기본값.
|
|
86
|
+
*
|
|
87
|
+
* 셋째 단계는 우리가 찾는다 — focus-trap 의 «첫 tabbable» 은 여는 순간 슬롯 자식 컴포넌트(`u-button` 의
|
|
88
|
+
* 섀도 안 버튼)를 보지 못해, 버튼만 든 대화상자의 포커스가 호스트에 머물렀다(브라우저 실측 — 네이티브
|
|
89
|
+
* `<button>` 은 잡았다. 열린 뒤의 Tab 가두기는 그 버튼들을 정상으로 돈다). 후보마다 실제로 포커스해 보고,
|
|
90
|
+
* 포커스가 그 안에 들어간 첫 요소에서 멈춘다(`delegatesFocus` 호스트가 안에 포커스할 것이 없으면 다음으로).
|
|
86
91
|
*
|
|
87
92
|
* 🔴**두 분기가 «각각» 무엇을 하는지 되돌려 재서 갈랐다** — 이 함수는 그 기록이다.
|
|
88
93
|
*
|
|
@@ -97,6 +102,8 @@ export declare abstract class UOverlayElement extends UElement {
|
|
|
97
102
|
* (`tests/browser/overlay-initial-focus.browser.test.ts` 가 둘 다 감시한다.)
|
|
98
103
|
*/
|
|
99
104
|
private resolveInitialFocus;
|
|
105
|
+
/** `el` 을 포커스하고, 실제 포커스가 그 안(섀도 포함)에 들어갔는가. */
|
|
106
|
+
private focusLands;
|
|
100
107
|
/** 오버레이가 닫힐 때 설정을 해제합니다. */
|
|
101
108
|
private cleanup;
|
|
102
109
|
/** host 자체를 클릭한 경우(백드롭)만 닫기 요청 */
|
|
@@ -121,7 +121,12 @@ var UOverlayElement = class extends UElement {
|
|
|
121
121
|
/**
|
|
122
122
|
* 열릴 때 포커스를 받을 요소를 정한다 — **입력을 먼저 본다.**
|
|
123
123
|
*
|
|
124
|
-
* 순서: `[autofocus]` → 첫 입력 컨트롤 → (없으면) focus-trap
|
|
124
|
+
* 순서: `[autofocus]` → 첫 입력 컨트롤 → 첫 포커스 가능 요소(섀도 안까지) → (없으면) focus-trap 기본값.
|
|
125
|
+
*
|
|
126
|
+
* 셋째 단계는 우리가 찾는다 — focus-trap 의 «첫 tabbable» 은 여는 순간 슬롯 자식 컴포넌트(`u-button` 의
|
|
127
|
+
* 섀도 안 버튼)를 보지 못해, 버튼만 든 대화상자의 포커스가 호스트에 머물렀다(브라우저 실측 — 네이티브
|
|
128
|
+
* `<button>` 은 잡았다. 열린 뒤의 Tab 가두기는 그 버튼들을 정상으로 돈다). 후보마다 실제로 포커스해 보고,
|
|
129
|
+
* 포커스가 그 안에 들어간 첫 요소에서 멈춘다(`delegatesFocus` 호스트가 안에 포커스할 것이 없으면 다음으로).
|
|
125
130
|
*
|
|
126
131
|
* 🔴**두 분기가 «각각» 무엇을 하는지 되돌려 재서 갈랐다** — 이 함수는 그 기록이다.
|
|
127
132
|
*
|
|
@@ -138,11 +143,16 @@ var UOverlayElement = class extends UElement {
|
|
|
138
143
|
resolveInitialFocus() {
|
|
139
144
|
const content = Array.from(this.children);
|
|
140
145
|
const target = querySelectorDeep(content, "[autofocus]", isFocusCandidate) ?? querySelectorDeep(content, "input, select, textarea, u-input, u-textarea, u-select, u-checkbox, u-radio, u-switch, u-slider", isFocusCandidate);
|
|
141
|
-
if (
|
|
142
|
-
|
|
146
|
+
if (target && this.focusLands(target)) return false;
|
|
147
|
+
return querySelectorDeep(content, "*", (el) => isFocusCandidate(el) && this.focusLands(el)) ? false : void 0;
|
|
148
|
+
}
|
|
149
|
+
/** `el` 을 포커스하고, 실제 포커스가 그 안(섀도 포함)에 들어갔는가. */
|
|
150
|
+
focusLands(el) {
|
|
151
|
+
el.focus();
|
|
143
152
|
let active = document.activeElement;
|
|
144
153
|
while (active?.shadowRoot?.activeElement) active = active.shadowRoot.activeElement;
|
|
145
|
-
for (let n = active; n; n = n.parentNode ?? n.host ?? null) if (n ===
|
|
154
|
+
for (let n = active; n; n = n.parentNode ?? n.host ?? null) if (n === el) return true;
|
|
155
|
+
return false;
|
|
146
156
|
}
|
|
147
157
|
/** 오버레이가 닫힐 때 설정을 해제합니다. */
|
|
148
158
|
cleanup() {
|
|
@@ -23,7 +23,8 @@ export declare function querySelectorAllWithin(element: Element, selectors: stri
|
|
|
23
23
|
export declare function isCoarsePointer(event: PointerEvent): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* 포커스를 «받을 수 있는» 요소인가 — 초기 포커스 후보를 고를 때 쓴다.
|
|
26
|
-
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · `
|
|
26
|
+
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · 섀도 루트가 `delegatesFocus` 인
|
|
27
|
+
* 호스트(`u-button` · `u-icon-button` — `focus()` 를 플랫폼이 안쪽으로 넘긴다) · `tabindex` 를 가진 요소이고,
|
|
27
28
|
* 비활성·`inert`·안 보임이 아니어야 한다. 걸러진 호스트는 그 안쪽(섀도 루트)에서 계속 찾는다.
|
|
28
29
|
* `u-select` 의 섀도에는 속성 `autofocus` 를 가진 닫힌 `u-popover` 가 늘 있다 — 이것을 집으면
|
|
29
30
|
* 포커스가 아무 데도 가지 않는다.
|
|
@@ -44,7 +44,8 @@ function isCoarsePointer(event) {
|
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* 포커스를 «받을 수 있는» 요소인가 — 초기 포커스 후보를 고를 때 쓴다.
|
|
47
|
-
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · `
|
|
47
|
+
* 네이티브 포커스 요소 · `focus()` 를 재정의한(안쪽으로 넘겨 주는) 컴포넌트 · 섀도 루트가 `delegatesFocus` 인
|
|
48
|
+
* 호스트(`u-button` · `u-icon-button` — `focus()` 를 플랫폼이 안쪽으로 넘긴다) · `tabindex` 를 가진 요소이고,
|
|
48
49
|
* 비활성·`inert`·안 보임이 아니어야 한다. 걸러진 호스트는 그 안쪽(섀도 루트)에서 계속 찾는다.
|
|
49
50
|
* `u-select` 의 섀도에는 속성 `autofocus` 를 가진 닫힌 `u-popover` 가 늘 있다 — 이것을 집으면
|
|
50
51
|
* 포커스가 아무 데도 가지 않는다.
|
|
@@ -52,7 +53,7 @@ function isCoarsePointer(event) {
|
|
|
52
53
|
function isFocusCandidate(el) {
|
|
53
54
|
if (!(el instanceof HTMLElement)) return false;
|
|
54
55
|
const native = el.matches("input:not([type=\"hidden\"]), select, textarea, button, a[href], [contenteditable=\"\"], [contenteditable=\"true\"]");
|
|
55
|
-
const forwards = el.focus !== HTMLElement.prototype.focus;
|
|
56
|
+
const forwards = el.focus !== HTMLElement.prototype.focus || el.shadowRoot?.delegatesFocus === true;
|
|
56
57
|
if (!native && !forwards && !el.hasAttribute("tabindex")) return false;
|
|
57
58
|
if (el.matches(":disabled") || el.hasAttribute("disabled") || el.closest("[inert]")) return false;
|
|
58
59
|
return typeof el.checkVisibility === "function" ? el.checkVisibility() : true;
|
package/package.json
CHANGED
|
@@ -108,6 +108,13 @@ The hint opens three ways — hovering the icon, entering the field's control fr
|
|
|
108
108
|
pins it until a tap elsewhere or a second tap). Escape closes it, and so does focus leaving the field. The icon itself
|
|
109
109
|
is not a Tab stop — a form of dozens of fields would otherwise double its Tabs.
|
|
110
110
|
|
|
111
|
+
## CSS Parts
|
|
112
|
+
|
|
113
|
+
| Part | Description |
|
|
114
|
+
|------|-------------|
|
|
115
|
+
| `hint` | The info icon beside the label (`description-display="hint"`) |
|
|
116
|
+
| `hint-tooltip` | The tooltip that holds the description |
|
|
117
|
+
|
|
111
118
|
## Methods
|
|
112
119
|
|
|
113
120
|
| Method | Description |
|