@@ -4,6 +4,7 @@ import { type UI5CustomEvent } from "@ui5/webcomponents-base";
44import InputClass from "@ui5/webcomponents/dist/Input.js" ;
55import SuggestionItemCustomClass from "@ui5/webcomponents/dist/SuggestionItemCustom.js" ;
66import IconClass from "@ui5/webcomponents/dist/Icon.js" ;
7+ import announce from "@ui5/webcomponents-base/dist/util/InvisibleMessage.js" ;
78import "@ui5/webcomponents/dist/features/InputSuggestions.js" ;
89import "@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