Shadow DOM Issue: Selection Dropdown Hangs Open When Clicked Elsewhere On Page
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 25.9k
- Forks
- 6.1k
- Avg merge
- 8d 53m
- Merged PRs (30d)
- 4
Description
As a user of Select2, I would like the dropdown menu to close when I click elsewhere on the page because this is the expected and natural behavior of selection dropdowns.
Expected Behavior:
When a the selection dropdown is open and a click happens outside of the dropdown menu, the dropdown menu should close.
Actual Behavior:
The dropdown does not close when a click event occurs outside of the open dropdown menu.
Steps To Reproduce:
Create a Select2 element in the Shadow DOM and configure it to open a dropdown menu when a user is selecting an option. Click outside of the dropdown menu and Select2 element. The dropdown menu will hang open.
Notes:
I consider this a bug and not a feature request because it seems that the default behavior of Select2 is that clicking outside of the dropdown menu closes it.
JSFiddle: https://jsfiddle.net/mslocum/kfqd7nga/
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 linked JSFiddle and reproduce the behavior using a Select2 element inside Shadow DOM. Trace how clicks outside the dropdown and Select2 element are handled, then verify that the dropdown closes when the outside click occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, jquery
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100