Skip to content

Commit

Permalink
test: adjusted focus keyboard handling check
Browse files Browse the repository at this point in the history
  • Loading branch information
kgogov committed May 28, 2024
1 parent 6ff682d commit 87026c7
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
5 changes: 0 additions & 5 deletions packages/fiori/src/NotificationListGroupItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@ class NotificationListGroupItem extends NotificationListItemBase {
}

async _onkeydown(e: KeyboardEvent) {
const isFocused = document.activeElement === this;
if (!isFocused) {
return;
}

await super._onkeydown(e);

const space = isSpace(e);
Expand Down
3 changes: 1 addition & 2 deletions packages/fiori/src/NotificationListItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,7 @@ class NotificationListItem extends NotificationListItemBase {
return;
}

const isFocused = document.activeElement === this;
if (isFocused || (!isUp(e) && !isDown(e))) {
if (!isUp(e) && !isDown(e)) {
return;
}

Expand Down
6 changes: 2 additions & 4 deletions packages/main/src/CustomListItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ class CustomListItem extends ListItem {

async _onkeydown(e: KeyboardEvent) {
const isTab = isTabNext(e) || isTabPrevious(e);
const isFocused = document.activeElement === this;

if (!isTab && !isFocused && !isF2(e)) {
if (!isTab && !isF2(e)) {
return;
}

Expand All @@ -65,9 +64,8 @@ class CustomListItem extends ListItem {

_onkeyup(e: KeyboardEvent) {
const isTab = isTabNext(e) || isTabPrevious(e);
const isFocused = document.activeElement === this;

if (!isTab && !isFocused && !isF2(e)) {
if (!isTab && !isF2(e)) {
return;
}

Expand Down
6 changes: 2 additions & 4 deletions packages/main/src/TreeItemCustom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ class TreeItemCustom extends TreeItemBase {

async _onkeydown(e: KeyboardEvent) {
const isTab = isTabNext(e) || isTabPrevious(e);
const isFocused = document.activeElement === this;

if (!isTab && !isFocused && !isF2(e)) {
if (!isTab && !isF2(e)) {
return;
}

Expand All @@ -63,9 +62,8 @@ class TreeItemCustom extends TreeItemBase {

_onkeyup(e: KeyboardEvent) {
const isTab = isTabNext(e) || isTabPrevious(e);
const isFocused = document.activeElement === this;

if (!isTab && !isFocused && !isF2(e)) {
if (!isTab && !isF2(e)) {
return;
}

Expand Down
26 changes: 26 additions & 0 deletions packages/main/test/pages/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,32 @@
</head>

<body class="list1auto">
<div id="host">
<template shadowrootmode="open">
<span>I'm in the shadow DOM</span>
<ui5-list header-text="API: CustomListItem" selection-mode="SingleEnd">
<ui5-li-custom>
<div class="list5auto">
<ui5-button>Press me</ui5-button>
<ui5-link>Go to SAP</ui5-link>
</div>
</ui5-li-custom>
<ui5-li-custom>
<div class="list5auto">
<ui5-button>Press me</ui5-button>
<ui5-link>Go to SAP</ui5-link>
</div>
</ui5-li-custom>
<ui5-li-custom>
<div class="list5auto">
<ui5-button>Press me</ui5-button>
<ui5-link>Go to SAP</ui5-link>
</div>
</ui5-li-custom>
</ui5-list>
</template>
</div>

<ui5-title>List growing="Scroll"</ui5-title>
<label class="list2auto">new items loaded:</label>
<label id="result" class="list2auto"> 0 times: 0</label>
Expand Down

0 comments on commit 87026c7

Please sign in to comment.