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

Feature Request: Ability to select multiple items without closing the list

Open Eric24 opened this issue 6 years ago • 8 comments

I don't believe it's currently possible, so this is a feature request, related to multi-select mode. Currently, each time a new item is selected, the list closes. The requested feature is to allow the list to stay open, allowing multiple items to be selected without closing and reopening the list each time. I could see this being a config option (with the default being the current behavior) and/or a way to specify a "key option" (i.e. selecting an item with the Ctrl/Cmd key pressed would not close the list, but clicking normally would).

Eric24 avatar Jan 07 '20 16:01 Eric24

@Eric24 There is already a prop which handles your use case. It is called closeMenuOnSelect and its default value is set to true, meaning the default behaviour is to close the menu when selecting an option. Setting the props value to false should allow for the behaviour you seek, keeping the menu open after selecting an option.

Rall3n avatar Jan 08 '20 07:01 Rall3n

@Rall3n : According to the docs, the closeMenuOnSelect prop is deprecated (only available in V1 of react-select). Is that correct?

Eric24 avatar Jan 13 '20 01:01 Eric24

@Eric24 I couldn’t find any mention of deprecation regarding this prop.

Rall3n avatar Jan 13 '20 06:01 Rall3n

@Rall3n : On this page: https://react-select.com/advanced

Below is an example of replicating the behaviour supported by the (deprecated) onSelectResetsInput and (deprecated) closeMenuOnSelect props in react-select v1

Am I misinterpreting this paragraph?

Eric24 avatar Jan 13 '20 14:01 Eric24

PS - The demo below that paragraph, that I think is trying to show the "new way" to manage the list, doesn't work anyway (the list closes on each select), but if I add closeMenuOnSelect={false} to the demo in the sandbox, it does work fine. Very confusing.

Eric24 avatar Jan 13 '20 14:01 Eric24

It seems that line in the docs was added a couple of years ago: https://github.com/JedWatson/react-select/commit/229592421199d2e7c22cae9ec34ee5ddb0673de5#diff-fd614ecf8dd9267fb749dff82585c022

However, according to the docs here there is no mention of deprecation: https://react-select.com/props#select-props

I use this option in a production environment with the latest version of react-select without issues. Maybe you could open a PR to remove this "deprecated" mention in the docs?

alexristich avatar Jan 14 '20 11:01 alexristich

https://github.com/JedWatson/react-select/issues/2032#issuecomment-502719989 - This can be a temporary solution to your problem. I used a variation of this and worked great !

SanjaySankar avatar Feb 03 '20 09:02 SanjaySankar

Greetings,

An update was made to the documentation to give more clarity in regards to what props have actually been removed and deprecated. closeMenuOnSelect can safely be used.

I will be closing this know, but please let us know if you have any other issues or concerns.

ebonow avatar Jan 14 '21 02:01 ebonow