Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui5-tree): improve keydown handling in content slot #10520

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/main/src/TreeItemCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import customElement from "@ui5/webcomponents-base/dist/decorators/customElement
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
import { isTabNext, isTabPrevious, isF2 } from "@ui5/webcomponents-base/dist/Keys.js";
import {
isTabNext,
isTabPrevious,
isF2,
isDown,
} from "@ui5/webcomponents-base/dist/Keys.js";
import TreeItemBase from "./TreeItemBase.js";

// Template
Expand Down Expand Up @@ -53,6 +58,10 @@ class TreeItemCustom extends TreeItemBase {
content!: Array<HTMLElement>;

async _onkeydown(e: KeyboardEvent) {
if (isDown(e) && this.content?.some(el => el.contains(e.target as Node))) {
e.stopPropagation();
return;
}
const isTab = isTabNext(e) || isTabPrevious(e);
const isFocused = this.matches(":focus");

Expand Down
Loading