[V2] focusedOption when rendering custom MenuList
In V2, I want to completely replace the MenuList including its children (the options). But then the option loses the default highlighted color when it is "focused". How could I keep that in V2?
In V1, there is a focusedOption prop which could be used to highlight the option manually.
Thanks!
@gwyneplaine Can you help with the answer, or clarify place where we can ask this question?
I also have this problem, need focusedOption for integrate react-virtualized or react-window.
Same issue here. I can easily set :hover however, when i set focus using keyboard there is no way how to highlight option. My component looks like this:
Menu: ({options: renderedOptions, selectOption, selectProps, innerProps, ...rest}) => (
<DropdownMenu className={`${classNamePrefix}__menu`} {...innerProps}>
{
renderedOptions && renderedOptions.length > 0
? (renderedOptions.map((option) => (
<DropdownItem
key={option[VALUE_KEY]}
tag="div"
onClick={() => selectOption(option)}
className={classnames(`${classNamePrefix}__menu-option`, {
[`${classNamePrefix}__menu-option_is-selected`]: selectProps.value && (
Array.isArray(selectProps.value)
? selectProps.value.some((selectedValue) => selectedValue[VALUE_KEY] === option[VALUE_KEY])
: selectProps.value[VALUE_KEY] === option[VALUE_KEY]),
})}
role="option"
>
{option.name}
</DropdownItem>
)))
: <span className={classnames(`${classNamePrefix}__no-options`)}>{msg.noOptions}</span>
}
</DropdownMenu>
),
Anyone fixed it?
+1 this is important
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.
If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.
However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!