Skip to content

Commit

Permalink
RG-2227 Clicking on a select label reopens the dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi committed Sep 6, 2024
1 parent 6d024b2 commit a685a07
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,21 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
});
};

isClickingSelect = false;

mouseDownHandler = () => {
this.isClickingSelect = true;
};

mouseUpHandler = () => {
this.isClickingSelect = false;
};

private _blurHandler = () => {
this.props.onBlur();

if (this._popup && this._popup.isVisible() && !this._popup.isClickingPopup) {
if (this._popup && this._popup.isVisible() && !this._popup.isClickingPopup &&
!this.isClickingSelect) {
window.setTimeout(() => {
this.setState({showPopup: false});
});
Expand Down Expand Up @@ -1308,6 +1319,9 @@ export default class Select<T = unknown> extends Component<SelectProps<T>, Selec
ref={this.nodeRef}
className={classNames(classes, styles.inputMode)}
data-test={dataTests('ring-select', dataTest)}
role="presentation" // has interactive elements inside
onMouseDown={this.mouseDownHandler}
onMouseUp={this.mouseUpHandler}
>
{shortcutsEnabled && (
<Shortcuts
Expand Down

0 comments on commit a685a07

Please sign in to comment.