Skip to content

Commit

Permalink
Replace stopPropagation with target check
Browse files Browse the repository at this point in the history
  • Loading branch information
rkulinski committed Mar 1, 2022
1 parent d5d4c77 commit 7fc125e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/allow-event-bubbling-for-all-controls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-select': patch
---

Replace stopPropagation with target check.
5 changes: 0 additions & 5 deletions .changeset/share-click-handler-for-dropdown-and-select.md

This file was deleted.

7 changes: 6 additions & 1 deletion packages/react-select/src/Select.tsx
Original file line number Diff line number Diff line change
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

0 comments on commit 7fc125e

Please sign in to comment.