[material-ui][Autocomplete] Shouldn't close popper if disableCloseOnSelect and the click is within the popper/paper
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Steps to reproduce
Link to live example: https://codesandbox.io/p/sandbox/autocomplete-dontcloseonselect-hlj9mp
Steps:
- Open dropdown
- Click outside of the
ulbut within the Popper or within the Paper.
Current behavior
The popper closes.
Expected behavior
The popper shouldn't close.
Context
Check this real life example: https://codesandbox.io/p/sandbox/autocomplete-multiple-popper-7w9tn6?file=%2Fsrc%2FAutocompleteMultiCustom.tsx%3A23%2C11-23%2C31
Not closing on Paper/Popper click would allow to easily implement things like SelectAll / DeselectAll and other stuff. In this example clicking on Select All closes the popper and doesn't even trigger SelectAll button click.
I'm not clear how the disableCloseOnSelect is implemented, but seems that it does not close the popper when the click is within the ul element. Because even though I customize ListboxComponent it still closes the popper.
(Alternatively another props can be added: disableCloseOnClickWithinPopper, disableCloseOnClickWithinPaper)
Your environment
No response
Search keywords: autocomplete disableCloseOnSelect popper close
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Autocomplete component's popper, paper, and listbox click-handling paths, using the linked CodeSandbox to reproduce the behavior. Done means clicks within the Popper or Paper do not close the popper when disableCloseOnSelect is enabled, while the existing listbox behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100