@thecb/components 6.0.0-beta.24 → 6.0.0-beta.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -107,6 +107,7 @@ const Dropdown = ({
|
|
|
107
107
|
const [selectedRef, setSelectedRef] = useState(undefined);
|
|
108
108
|
const [focusedRef, setFocusedRef] = useState(undefined);
|
|
109
109
|
const [inputChangedByAutofill, setInputChangedByAutofill] = useState(false);
|
|
110
|
+
const inputBox = useRef(null);
|
|
110
111
|
|
|
111
112
|
if (optionsState !== options) {
|
|
112
113
|
setOptionsState(options);
|
|
@@ -208,9 +209,11 @@ const Dropdown = ({
|
|
|
208
209
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
209
210
|
// WAI-ARIA requires the selected option to receive focus
|
|
210
211
|
selectedRef.current.focus();
|
|
212
|
+
inputBox.current.focus();
|
|
211
213
|
} else if (isOpen && optionRefs.current[0].current) {
|
|
212
214
|
// If no selected option, first option receives focus
|
|
213
215
|
optionRefs.current[0].current.focus();
|
|
216
|
+
inputBox.current.focus();
|
|
214
217
|
}
|
|
215
218
|
clearTimeout(timer);
|
|
216
219
|
setInputValue("");
|
|
@@ -313,6 +316,7 @@ const Dropdown = ({
|
|
|
313
316
|
}}
|
|
314
317
|
padding="12px"
|
|
315
318
|
placeholder={getSelection()}
|
|
319
|
+
ref={inputBox}
|
|
316
320
|
role="combobox"
|
|
317
321
|
themeValues={themeValues}
|
|
318
322
|
title={hasTitles ? getSelection() : null}
|