Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate handler for indicator #5085

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/allow-event-bubbling-for-all-controls.md
@@ -0,0 +1,5 @@
---
'react-select': patch
---

Replace stopPropagation with target check.
7 changes: 6 additions & 1 deletion packages/react-select/src/Select.tsx
Expand Up @@ -1156,6 +1156,11 @@ export default class Select<
onControlMouseDown = (
event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>
) => {
// Event captured by dropdown indicator
// @ts-ignore
if (event.target.closest('.DropdownIndicatorContainer')) {
return;
}
const { openMenuOnClick } = this.props;
if (!this.state.isFocused) {
if (openMenuOnClick) {
Expand Down Expand Up @@ -1202,7 +1207,6 @@ export default class Select<
this.openMenu('first');
}
event.preventDefault();
event.stopPropagation();
};
onClearIndicatorMouseDown = (
event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>
Expand Down Expand Up @@ -1776,6 +1780,7 @@ export default class Select<

return (
<DropdownIndicator
className="DropdownIndicatorContainer"
{...commonProps}
innerProps={innerProps}
isDisabled={isDisabled}
Expand Down