mirror of
https://github.com/fergalmoran/turnstone.git
synced 2025-12-26 19:57:37 +00:00
Do not show typeahead unless there is more than one item in the listbox
This commit is contained in:
@@ -78,6 +78,8 @@ export default function Container(props) {
|
||||
const typeaheadInput = useRef(null)
|
||||
|
||||
// Calculated states
|
||||
console.log('hasTypeahead', typeahead, state.items.length > 1)
|
||||
const hasTypeahead = typeahead && state.items.length > 1
|
||||
const hasClearButton = clearButton && !!state.query
|
||||
const hasCancelButton = cancelButton && hasFocus
|
||||
const isExpanded = hasFocus && state.itemsLoaded
|
||||
@@ -241,7 +243,7 @@ export default function Container(props) {
|
||||
aria-controls={listboxId}
|
||||
/>
|
||||
|
||||
{typeahead && (
|
||||
{hasTypeahead && (
|
||||
<input
|
||||
className={`${inputStyles || ''} ${customStyles.typeahead || ''}`.trim()}
|
||||
style={defaultStyles.typeahead}
|
||||
|
||||
Reference in New Issue
Block a user