@thecb/components 6.0.0-beta.25 → 6.0.0-beta.26
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,7 +107,6 @@ 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);
|
|
111
110
|
|
|
112
111
|
if (optionsState !== options) {
|
|
113
112
|
setOptionsState(options);
|
|
@@ -122,6 +121,7 @@ const Dropdown = ({
|
|
|
122
121
|
const [timer, setTimer] = useState(null);
|
|
123
122
|
const optionRefs = useRef([...Array(options.length)].map(() => createRef()));
|
|
124
123
|
const dropdownRef = useRef(null);
|
|
124
|
+
const inputRef = useRef(null);
|
|
125
125
|
|
|
126
126
|
const getSelection = () =>
|
|
127
127
|
value ? options.find(option => option.value === value)?.text : placeholder;
|
|
@@ -209,11 +209,11 @@ const Dropdown = ({
|
|
|
209
209
|
if (isOpen && selectedRef !== undefined && selectedRef.current !== null) {
|
|
210
210
|
// WAI-ARIA requires the selected option to receive focus
|
|
211
211
|
selectedRef.current.focus();
|
|
212
|
-
|
|
212
|
+
console.log("input box ref", inputRef, inputRef.current);
|
|
213
213
|
} else if (isOpen && optionRefs.current[0].current) {
|
|
214
214
|
// If no selected option, first option receives focus
|
|
215
215
|
optionRefs.current[0].current.focus();
|
|
216
|
-
|
|
216
|
+
console.log("input box ref", inputRef, inputRef.current);
|
|
217
217
|
}
|
|
218
218
|
clearTimeout(timer);
|
|
219
219
|
setInputValue("");
|
|
@@ -316,7 +316,7 @@ const Dropdown = ({
|
|
|
316
316
|
}}
|
|
317
317
|
padding="12px"
|
|
318
318
|
placeholder={getSelection()}
|
|
319
|
-
ref={
|
|
319
|
+
ref={inputRef}
|
|
320
320
|
role="combobox"
|
|
321
321
|
themeValues={themeValues}
|
|
322
322
|
title={hasTitles ? getSelection() : null}
|