(value: string)
| 293 | }); |
| 294 | |
| 295 | let onChange = (value: string) => { |
| 296 | // Tell wrapped collection to focus the first element in the list when typing forward and to clear focused key when modifying the text via |
| 297 | // copy paste/backspacing/undo/redo for screen reader announcements |
| 298 | if ( |
| 299 | (lastInputType.current === 'insertText' || |
| 300 | // IME composition (e.g. CJK input) reports 'insertCompositionText'/'insertFromComposition' |
| 301 | // instead of 'insertText'. Treat these as forward typing so the first item gets virtual focus. |
| 302 | lastInputType.current === 'insertCompositionText' || |
| 303 | lastInputType.current === 'insertFromComposition') && |
| 304 | !disableAutoFocusFirst |
| 305 | ) { |
| 306 | focusFirstItem(); |
| 307 | } else if ( |
| 308 | lastInputType.current && |
| 309 | (lastInputType.current.includes('insert') || |
| 310 | lastInputType.current.includes('delete') || |
| 311 | lastInputType.current.includes('history')) |
| 312 | ) { |
| 313 | clearVirtualFocus(true); |
| 314 | |
| 315 | // If onChange was triggered before the timeout actually updated the activedescendant, we need to fire |
| 316 | // our own dispatchVirtualFocus so focusVisible gets reapplied on the input |
| 317 | if (getVirtuallyFocusedElement(document) === inputRef.current) { |
| 318 | dispatchVirtualFocus(inputRef.current!, null); |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | state.setInputValue(value); |
| 323 | }; |
| 324 | |
| 325 | let keyDownTarget = useRef<Element | null>(null); |
| 326 | // For textfield specific keydown operations |
nothing calls this directly
no test coverage detected