Skip to content
Merged
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions packages/fiori/cypress/specs/Search.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,38 @@ describe("Accessibility", () => {
cy.get("[ui5-search]")
.should("be.focused");
});

it("should have aria-autocomplete='both' on the input element", () => {
cy.mount(
<Search>
<SearchItem text="Item 1" icon={history} />
</Search>
);

cy.get("[ui5-search]")
.shadow()
.find("input")
.should("have.attr", "aria-autocomplete", "both");
});

it("should have aria-controls pointing to responsive popover", () => {
cy.mount(
<Search>
<SearchItem text="Item 1" icon={history} />
</Search>
);

cy.get("[ui5-search]")
.shadow()
.find("input")
.invoke("attr", "aria-controls")
.then((ariaControlsId) => {
cy.get("[ui5-search]")
.shadow()
.find("[ui5-responsive-popover]")
.should("have.attr", "id", ariaControlsId);
});
});
});

describe("Lazy loaded items and autocomplete", () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/fiori/src/SearchFieldTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ export default function SearchFieldTemplate(this: SearchField, options?: SearchF
role="searchbox"
aria-description={this.accessibleDescription}
aria-label={this.accessibleName || this._translations.searchFieldAriaLabel}
aria-autocomplete="both"
aria-controls="ui5-search-list"
value={this.value}
placeholder={this.placeholder}
data-sap-focus-ref
Expand Down
7 changes: 5 additions & 2 deletions packages/fiori/src/SearchItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import SearchItemCss from "./generated/themes/SearchItem.css.js";
import generateHighlightedMarkup from "@ui5/webcomponents-base/dist/util/generateHighlightedMarkup.js";
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
import { SEARCH_ITEM_DELETE_BUTTON } from "./generated/i18n/i18n-defaults.js";
import {
SEARCH_ITEM_DELETE_BUTTON_TOOLTIP,
} from "./generated/i18n/i18n-defaults.js";

import getActiveElement from "@ui5/webcomponents-base/dist/util/getActiveElement.js";
import { getFirstFocusableElement } from "@ui5/webcomponents-base/dist/util/FocusableElements.js";
import { getTabbableElements } from "@ui5/webcomponents-base/dist/util/TabbableElements.js";
Expand Down Expand Up @@ -259,7 +262,7 @@ class SearchItem extends ListItemBase {
}

get _deleteButtonTooltip() {
return SearchItem.i18nBundle.getText(SEARCH_ITEM_DELETE_BUTTON);
return SearchItem.i18nBundle.getText(SEARCH_ITEM_DELETE_BUTTON_TOOLTIP);
}

get hasActions() {
Expand Down
1 change: 1 addition & 0 deletions packages/fiori/src/SearchPopoverTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type { JsxTemplate } from "@ui5/webcomponents-base/dist/index.js";
export default function SearchPopoverTemplate(this: Search, headerTemplate?: JsxTemplate) {
return (
<ResponsivePopover
id="ui5-search-list"
hideArrow={true}
preventFocusRestore={true}
preventInitialFocus={!isPhone()}
Expand Down
4 changes: 2 additions & 2 deletions packages/fiori/src/i18n/messagebundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ SHELLBAR_IMAGE_BTN = User Menu
#XACT: ARIA announcement for the search button
SHELLBAR_SEARCH_BTN_OPEN = Open Search

#XACT: ARIA announcement for the search item delete button
SEARCH_ITEM_DELETE_BUTTON=Remove Suggestion
#XACT: ARIA announcement for the search item delete button tooltip
SEARCH_ITEM_DELETE_BUTTON_TOOLTIP=Remove Suggestion

#XACT: ARIA announcement for the more button
SHELLBAR_OVERFLOW = More
Expand Down
Loading