Khan / react-multi-select

A multiple select component for React
MIT License
184 stars 97 forks source link

Space not allow in search issue #32

Open sagar-prolix opened 5 years ago

sagar-prolix commented 5 years ago

How can i override search functionality.

echappen commented 5 years ago

I'm having the same issue with search input text fields where spaces do not register, so I'm unable to type multiple words. The e.target.value is not including the spaces typed, which leads me to believe that text inputs are being manipulated somewhere globally in the package, but I can't pinpoint where.

This issue can be observed on the Storybook Demo on default view.

package version: 0.3.2

erikbrannstrom commented 5 years ago

I've got the same issue with 0.3.3 running Chrome 75.0.3770.100 on MacOS 10.14.3.

It seems the problem is that there is an onKeyDown listener on the component to allow expanding the dropdown using e.g. space, but this handler also runs while typing in the search field which prevents the onChange event in the input field. Removing the onKeyDown listeners fixes the problem, but I'm guessing the maintainers would prefer a more elegant solution.

ElNath11 commented 4 years ago

I have same issues, the search input text not let me adding space if the 'search word' is having 2 word or more

v-honcharenko commented 4 years ago

@ElNath11 Try to use filterOptions prop. It looks kike this:

(options: Array<Option>, filter: string) => Array<Option>
ycgambo commented 4 years ago

node_modules/@khanacademy/react-multi-select/dist/dropdown.js:64

  1. comment this line
                case 13: // Enter Key
                // patch: this will not allow to input space
                // case 32: // Space
                case 40:
                    // Down Arrow
                    _this.toggleExpanded(true);
                    break;
  2. patch this package to version control

follow guide of patch-package

jb-modist commented 3 years ago

Followed the patch guide only expand if not already expanded

                    if (expanded) {
                        _this.toggleExpanded(true);
                    } else {
                        return;
                    }