Reputation: 2675
I have a blueprintjs select component and I was wondering how to enable keyboard navigation on the component. I followed their documentation but couldn't get a better understanding of it. Is it an issue with itemRendered modifier prop? Please advice.
Below is the link I have implemented using blueprintjs select:
Any help is greatly appreciated.
Upvotes: 2
Views: 804
Reputation: 24939
no need to implement onActiveItemChange
as per documentation here: https://blueprintjs.com/docs/#select/multi-select
ensure your item renderer you set active={modifiers.active}
:
private renderFilm: ItemRenderer<IFilm> = (film, { modifiers, handleClick }) => {
if (!modifiers.matchesPredicate) {
return null;
}
return (
<MenuItem
active={modifiers.active}
Upvotes: 0
Reputation: 1033
You just need to wire up onActiveItemChange
to update the value you're using for activeItem
on the Select as so:
<CountrySelect
items={countryCodes || []}
onItemSelect={handleItemSelect}
activeItem={selectedCountry}
onActiveItemChange={setSelectedCountry}
{...CountrySelectProps}
noResults={<MenuItem disabled={true} text="No results." />}
>
Upvotes: 1