@iyulab/components 2.0.2 → 2.0.3
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 +12 -0
- package/dist/components/menu/UMenu.js +2 -0
- package/dist/components/menu-item/UMenuItem.js +2 -0
- package/dist/components/tab-panel/UTabPanel.js +2 -1
- package/dist/components/tree/UTree.js +2 -0
- package/dist/components/tree-item/UTreeItem.js +2 -0
- package/dist/utilities/nestedControl.d.ts +10 -0
- package/dist/utilities/nestedControl.js +20 -0
- package/package.json +1 -1
- package/skills/iyulab-components/references/components/menu.md +3 -0
- package/skills/iyulab-components/references/components/tab-panel.md +3 -0
- package/skills/iyulab-components/references/components/tree.md +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.3] - 2026-10-06
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **A control in a tree item, menu item or tab slot keeps its own keys and clicks** (`u-tree-item`,
|
|
8
|
+
`u-menu-item`, `u-tab`). A button placed in the `prefix`/`suffix` slot could not be pressed from
|
|
9
|
+
the keyboard — Enter and Space were taken by the tree or menu and selected the item instead — an
|
|
10
|
+
arrow key on it moved to the next item, and a mouse click on it also selected or expanded the item
|
|
11
|
+
and stopped there, so a listener outside never saw it. Keys and clicks from such a control now go
|
|
12
|
+
to the control only; the item's keyboard model applies while the item itself has focus, as with
|
|
13
|
+
interactive content inside `<summary>` or `<label>`.
|
|
14
|
+
|
|
3
15
|
## [2.0.2] - 2026-10-06
|
|
4
16
|
|
|
5
17
|
### Fixed
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
4
5
|
import { UMenuItem } from "../menu-item/UMenuItem.js";
|
|
5
6
|
import { styles } from "./UMenu.styles.js";
|
|
6
7
|
import { html } from "lit";
|
|
@@ -38,6 +39,7 @@ var UMenu = class UMenu extends UElement {
|
|
|
38
39
|
this.handleKeydown = (e) => {
|
|
39
40
|
const focused = e.composedPath().find((el) => el instanceof UMenuItem);
|
|
40
41
|
if (!focused) return;
|
|
42
|
+
if (isFromNestedControl(e, focused)) return;
|
|
41
43
|
const items = this.inline ? this.getItems((item) => {
|
|
42
44
|
if (item.disabled) return false;
|
|
43
45
|
let current = item.parentItem;
|
|
@@ -5,6 +5,7 @@ import "../icon/UIcon.js";
|
|
|
5
5
|
import "../popover/UPopover.js";
|
|
6
6
|
import { UDivider } from "../divider/UDivider.js";
|
|
7
7
|
import { styles } from "./UMenuItem.styles.js";
|
|
8
|
+
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
8
9
|
import { html } from "lit";
|
|
9
10
|
import { customElement, property, state } from "lit/decorators.js";
|
|
10
11
|
import { live } from "lit/directives/live.js";
|
|
@@ -28,6 +29,7 @@ var UMenuItem = class UMenuItem extends UElement {
|
|
|
28
29
|
this._parentItem = null;
|
|
29
30
|
this._childItems = [];
|
|
30
31
|
this.handleHeaderClick = (e) => {
|
|
32
|
+
if (isFromNestedControl(e, this)) return;
|
|
31
33
|
e.stopPropagation();
|
|
32
34
|
if (this.disabled) return;
|
|
33
35
|
if (!this.leaf) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
4
5
|
import { UPanel } from "../panel/UPanel.js";
|
|
5
6
|
import { UTab } from "../tab/UTab.js";
|
|
6
7
|
import { styles } from "./UTabPanel.styles.js";
|
|
@@ -44,7 +45,7 @@ var UTabPanel = class UTabPanel extends UElement {
|
|
|
44
45
|
this.change(tab.value);
|
|
45
46
|
};
|
|
46
47
|
this.handleTabKeydown = (e) => {
|
|
47
|
-
if (e
|
|
48
|
+
if (isFromNestedControl(e, e.currentTarget)) return;
|
|
48
49
|
const enabledTabs = this.tabs.filter((t) => !t.disabled);
|
|
49
50
|
const currentIndex = enabledTabs.indexOf(e.currentTarget);
|
|
50
51
|
if (currentIndex === -1) return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
|
+
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
4
5
|
import { UTreeItem } from "../tree-item/UTreeItem.js";
|
|
5
6
|
import { styles } from "./UTree.styles.js";
|
|
6
7
|
import { html } from "lit";
|
|
@@ -71,6 +72,7 @@ var UTree = class UTree extends UElement {
|
|
|
71
72
|
this.handleKeydown = (e) => {
|
|
72
73
|
const focused = e.composedPath().find((el) => el instanceof UTreeItem);
|
|
73
74
|
if (!focused) return;
|
|
75
|
+
if (isFromNestedControl(e, focused)) return;
|
|
74
76
|
const items = this.getItems((item) => !item.disabled && (!item.parentItem || item.parentItem.expanded));
|
|
75
77
|
if (items.length === 0) return;
|
|
76
78
|
const current = focused ? items.indexOf(focused) : -1;
|
|
@@ -3,6 +3,7 @@ import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/hel
|
|
|
3
3
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import "../spinner/USpinner.js";
|
|
5
5
|
import "../icon/UIcon.js";
|
|
6
|
+
import { isFromNestedControl } from "../../utilities/nestedControl.js";
|
|
6
7
|
import { styles } from "./UTreeItem.styles.js";
|
|
7
8
|
import { html } from "lit";
|
|
8
9
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -40,6 +41,7 @@ var UTreeItem = class UTreeItem extends UElement {
|
|
|
40
41
|
this.propagate();
|
|
41
42
|
};
|
|
42
43
|
this.handleHeaderClick = (e) => {
|
|
44
|
+
if (isFromNestedControl(e, this)) return;
|
|
43
45
|
e.stopPropagation();
|
|
44
46
|
if (this.disabled) return;
|
|
45
47
|
if (this.selectable) this.fire("pick", { detail: {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 이벤트가 `owner` «안의» 다른 상호작용 요소(포커스를 받는 요소)에서 왔는가.
|
|
3
|
+
*
|
|
4
|
+
* 항목(탭 · 트리 항목 · 메뉴 항목)은 슬롯으로 버튼 같은 컨트롤을 받는다. 그 컨트롤의 키와 클릭은 컨트롤의 것이다 —
|
|
5
|
+
* `<summary>`·`<label>` 안의 상호작용 콘텐츠가 조상을 활성화하지 않는 것과 같다. 항목의 키보드 모델과 클릭 활성화는
|
|
6
|
+
* 이것이 거짓일 때만 해석한다.
|
|
7
|
+
*
|
|
8
|
+
* 내부 모듈이다 — 배럴에서 내보내지 않는다.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isFromNestedControl(e: Event, owner: Element): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isFocusable } from "tabbable";
|
|
2
|
+
//#region src/utilities/nestedControl.ts
|
|
3
|
+
/**
|
|
4
|
+
* 이벤트가 `owner` «안의» 다른 상호작용 요소(포커스를 받는 요소)에서 왔는가.
|
|
5
|
+
*
|
|
6
|
+
* 항목(탭 · 트리 항목 · 메뉴 항목)은 슬롯으로 버튼 같은 컨트롤을 받는다. 그 컨트롤의 키와 클릭은 컨트롤의 것이다 —
|
|
7
|
+
* `<summary>`·`<label>` 안의 상호작용 콘텐츠가 조상을 활성화하지 않는 것과 같다. 항목의 키보드 모델과 클릭 활성화는
|
|
8
|
+
* 이것이 거짓일 때만 해석한다.
|
|
9
|
+
*
|
|
10
|
+
* 내부 모듈이다 — 배럴에서 내보내지 않는다.
|
|
11
|
+
*/
|
|
12
|
+
function isFromNestedControl(e, owner) {
|
|
13
|
+
for (const node of e.composedPath()) {
|
|
14
|
+
if (node === owner) return false;
|
|
15
|
+
if (node instanceof Element && isFocusable(node)) return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { isFromNestedControl };
|
package/package.json
CHANGED
|
@@ -79,6 +79,9 @@ Keyboard-navigable menu. Supports single/multiple selection, highlight or checkm
|
|
|
79
79
|
| `suffix` | Trailing content |
|
|
80
80
|
| `children` | Nested `u-menu` for sub-menu |
|
|
81
81
|
|
|
82
|
+
A control placed in a slot (a button, a link) keeps its own keys and clicks — it does not select or
|
|
83
|
+
activate the menu item, and the menu item's arrow-key navigation applies only while the menu item itself has focus.
|
|
84
|
+
|
|
82
85
|
### Properties
|
|
83
86
|
|
|
84
87
|
| Property | Type | Default | Reflect | Description |
|
|
@@ -101,6 +101,9 @@ selected tab is a tab stop (arrow keys, Home and End move between tabs and selec
|
|
|
101
101
|
| *(default)* | Tab label |
|
|
102
102
|
| `suffix` | Trailing content |
|
|
103
103
|
|
|
104
|
+
A control placed in a slot (a button, a link) keeps its own keys and clicks — it does not select or
|
|
105
|
+
activate the tab, and the tab's arrow-key navigation applies only while the tab itself has focus.
|
|
106
|
+
|
|
104
107
|
### Properties
|
|
105
108
|
|
|
106
109
|
| Property | Type | Default | Reflect | Description |
|
|
@@ -87,6 +87,9 @@ Hierarchical tree with support for selection, checkboxes, cascade check, and dra
|
|
|
87
87
|
| *(default)* | Item label |
|
|
88
88
|
| `suffix` | Trailing content |
|
|
89
89
|
|
|
90
|
+
A control placed in a slot (a button, a link) keeps its own keys and clicks — it does not select or
|
|
91
|
+
activate the tree item, and the tree item's arrow-key navigation applies only while the tree item itself has focus.
|
|
92
|
+
|
|
90
93
|
### Properties
|
|
91
94
|
|
|
92
95
|
| Property | Type | Default | Reflect | Description |
|