;
+
_markupText = "";
@i18n("@ui5/webcomponents-fiori")
@@ -133,8 +148,20 @@ class SearchItem extends ListItemBase {
}
async _onkeydown(e: KeyboardEvent) {
+ // Handle manual tab navigation between action items
+ if (isTabNext(e) || isTabPrevious(e)) {
+ const handled = this._handleTabNavigation(e);
+ if (handled) {
+ e.preventDefault();
+ e.stopPropagation();
+ return;
+ }
+ }
+
+ // Call super for other key handling
super._onkeydown(e);
+ // Handle space/enter when focus is within action items
if (this.getFocusDomRef()!.matches(":has(:focus-within)")) {
if (isSpace(e) || isEnter(e)) {
e.preventDefault();
@@ -142,6 +169,7 @@ class SearchItem extends ListItemBase {
}
}
+ // Handle F2 for focus navigation
if (isF2(e)) {
e.stopImmediatePropagation();
const activeElement = getActiveElement();
@@ -160,6 +188,51 @@ class SearchItem extends ListItemBase {
}
}
+ /**
+ * Handles manual tab navigation between action items and delete button
+ */
+ _handleTabNavigation(e: KeyboardEvent): boolean {
+ const focusDomRef = this.getFocusDomRef();
+ if (!focusDomRef) {
+ return false;
+ }
+
+ const tabbableElements = getTabbableElements(focusDomRef);
+ if (tabbableElements.length === 0) {
+ return false;
+ }
+
+ const activeElement = getActiveElement() as HTMLElement;
+ const currentIndex = tabbableElements.indexOf(activeElement);
+
+ if (currentIndex === -1) {
+ return false;
+ }
+
+ let nextElement: HTMLElement | null = null;
+
+ if (isTabNext(e)) {
+ if (currentIndex < tabbableElements.length - 1) {
+ nextElement = tabbableElements[currentIndex + 1];
+ } else {
+ return false;
+ }
+ } else if (isTabPrevious(e)) {
+ if (currentIndex > 0) {
+ nextElement = tabbableElements[currentIndex - 1];
+ } else {
+ return false;
+ }
+ }
+
+ if (nextElement) {
+ nextElement.focus();
+ return true;
+ }
+
+ return false;
+ }
+
_onDeleteButtonClick() {
this.fireDecoratorEvent("delete");
}
@@ -177,9 +250,24 @@ class SearchItem extends ListItemBase {
this._markupText = this.highlightText ? generateHighlightedMarkup((this.text || ""), this.highlightText) : encodeXML(this.text || "");
}
+ /**
+ * Determines if the current search item either has no tabbable content or
+ * [Tab] is performed on the last tabbable content item.
+ * This method is crucial for proper tab navigation between action items.
+ */
+ shouldForwardTabAfter() {
+ const aContent = getTabbableElements(this.getFocusDomRef()!);
+
+ return aContent.length === 0 || (aContent[aContent.length - 1] === getActiveElement());
+ }
+
get _deleteButtonTooltip() {
return SearchItem.i18nBundle.getText(SEARCH_ITEM_DELETE_BUTTON);
}
+
+ get hasActions() {
+ return !!this.actions.length;
+ }
}
SearchItem.define();
diff --git a/packages/fiori/src/SearchItemTemplate.tsx b/packages/fiori/src/SearchItemTemplate.tsx
index 489a516e069d..18affbe31b5e 100644
--- a/packages/fiori/src/SearchItemTemplate.tsx
+++ b/packages/fiori/src/SearchItemTemplate.tsx
@@ -44,14 +44,22 @@ export default function SearchFieldTemplate(this: SearchItem) {
{this.description}
- {this.deletable &&
-
- }
+
+ {this.hasActions &&
+
+
+
+ }
+
+ {this.deletable &&
+
+ }
+
diff --git a/packages/fiori/src/themes/SearchItem.css b/packages/fiori/src/themes/SearchItem.css
index 00eb8f3a0e6d..deef749c5ed5 100644
--- a/packages/fiori/src/themes/SearchItem.css
+++ b/packages/fiori/src/themes/SearchItem.css
@@ -24,15 +24,35 @@
flex: 1;
}
+.ui5-search-item-actions-container {
+ display: flex;
+ align-items: center;
+ gap: 0.125rem;
+}
+
:host([desktop]) .ui5-search-item-selected-delete {
display: none;
}
+:host([desktop]) .ui5-search-item-actions {
+ display: none;
+}
+
:host(:hover),
:host(:focus-within) {
.ui5-search-item-selected-delete {
display: inline-block;
}
+
+ .ui5-search-item-actions {
+ display: flex;
+ }
+}
+
+.ui5-search-item-actions {
+ display: flex;
+ align-items: center;
+ gap: 0.25rem;
}
.ui5-search-item-text {
@@ -85,4 +105,4 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
-}
\ No newline at end of file
+}
diff --git a/packages/fiori/test/pages/Search.html b/packages/fiori/test/pages/Search.html
index 475006aebff2..6c914b80b5b7 100644
--- a/packages/fiori/test/pages/Search.html
+++ b/packages/fiori/test/pages/Search.html
@@ -182,6 +182,28 @@
+
+ Search with Actions - Example of flexible action slot
+
+
+
+
+
+
+
+
+
+
+
+
+ Important
+
+
+
+ Hover over search items to see secondary actions. Use Tab/Shift+Tab to navigate between action buttons and delete button.
+
+
+
Search with Suggestions - Filter by typing