react-select icon indicating copy to clipboard operation
react-select copied to clipboard

[V2] focusedOption when rendering custom MenuList

Open PengyuanZhao opened this issue 8 years ago • 5 comments

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!

PengyuanZhao avatar May 15 '18 20:05 PengyuanZhao

@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.

nkhristinin avatar Sep 18 '18 07:09 nkhristinin

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>
),

jakub-chatrny avatar Oct 05 '18 11:10 jakub-chatrny

Anyone fixed it?

ghost avatar Dec 14 '18 14:12 ghost

+1 this is important

mike391 avatar Dec 21 '18 15:12 mike391

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!

bladey avatar May 28 '20 02:05 bladey