From a685a07629dac62a6d09b6a3760c461e77f610c9 Mon Sep 17 00:00:00 2001 From: Filipp Riabchun Date: Fri, 6 Sep 2024 13:50:52 +0200 Subject: [PATCH] RG-2227 Clicking on a select label reopens the dropdown --- src/select/select.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/select/select.tsx b/src/select/select.tsx index e4c4a0bd621..ca74815a301 100644 --- a/src/select/select.tsx +++ b/src/select/select.tsx @@ -572,10 +572,21 @@ export default class Select extends Component, 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}); }); @@ -1308,6 +1319,9 @@ export default class Select extends Component, 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 && (