fix(multiselect): scope chevron clicks to the correct container #643
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
🚀 Description
This PR fixes an issue with multiple multiselect components on the same page. Previously, when clicking on a multiselect container, the code would use
document.querySelector
to find the input element, which could incorrectly target the first multiselect on the page rather than the one that was clicked.The fix modifies the
handleContainerClick
method to:Added a comprehensive test case that verifies multiple multiselect components work correctly when placed on the same page.
🔬 How to Test
📸 Images/Videos of Functionality
No visual changes to the component's appearance - this is a behavioral fix that ensures the correct multiselect responds when clicked. Here's a before & after of the docs that show the bad behavior.
before.mp4
after.mp4