Skip to content

Commit f792ca0

Browse files
Merge branch 'main' into user-menu-item
2 parents 6d0d1ee + a923725 commit f792ca0

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

packages/website/docs/_samples/main/Input/CustomSuggestions/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const fillInput = (data, value) => {
3535

3636
item.innerHTML = `
3737
<div class='item-content'>
38-
<ui5-icon name="globe"></ui5-icon>
38+
<ui5-icon name="globe" aria-hidden="true"></ui5-icon>
3939
<div class='item-titles'>
4040
<span>${generateHighlightedMarkup(country, value)}</span>
4141
<small>EU</small>
@@ -51,5 +51,5 @@ const fillInput = (data, value) => {
5151
input.addEventListener("ui5-selection-change", e => {
5252
const text = e.detail.item?.text;
5353

54-
announce(text, "Polite");
54+
announce(text + " EU", "Polite");
5555
})

packages/website/docs/_samples/main/Input/CustomSuggestions/sample.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { type UI5CustomEvent } from "@ui5/webcomponents-base";
44
import InputClass from "@ui5/webcomponents/dist/Input.js";
55
import SuggestionItemCustomClass from "@ui5/webcomponents/dist/SuggestionItemCustom.js";
66
import IconClass from "@ui5/webcomponents/dist/Icon.js";
7+
import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js";
78
import "@ui5/webcomponents/dist/features/InputSuggestions.js";
89
import "@ui5/webcomponents-icons/dist/globe.js";
910

@@ -27,6 +28,11 @@ function App() {
2728
const [suggestions, setSuggestions] = useState<string[]>([]);
2829
const [inputValue, setInputValue] = useState("");
2930

31+
const handleSelectionChange = (e: UI5CustomEvent<InputClass, "selection-change">) => {
32+
const text = (e.detail as any).item?.text;
33+
announce(text + " EU", "Polite");
34+
};
35+
3036
const handleInput = (e: UI5CustomEvent<InputClass, "input">) => {
3137
const value = e.currentTarget.value;
3238
setInputValue(value);
@@ -63,11 +69,12 @@ function App() {
6369
placeholder="Type something ..."
6470
showSuggestions={true}
6571
onInput={handleInput}
72+
onSelectionChange={handleSelectionChange}
6673
>
6774
{suggestions.map((country) => (
6875
<SuggestionItemCustom key={country} text={country}>
6976
<div className="item-content">
70-
<Icon name="globe" />
77+
<Icon name="globe" aria-hidden="true" />
7178
<div className="item-titles">
7279
<span>{country}</span>
7380
<small>EU</small>

0 commit comments

Comments
 (0)