Skip to content

Commit 8c6cd21

Browse files
committed
fix(Dropdown): Keep open dropdown focused on mousedown
Ensure that dropdown focus is not taken over by mousedown propagation. Otherwise, this could cause the dropdown from remaining open after onClick option.
1 parent ff70355 commit 8c6cd21

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/modules/Dropdown/Dropdown.js

+5
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,15 @@ export default class Dropdown extends Component {
402402

403403
handleMouseDown = (e) => {
404404
debug('handleMouseDown()')
405+
const { open } = this.state
405406

406407
this.isMouseDown = true
407408
_.invoke(this.props, 'onMouseDown', e, this.props)
408409
document.addEventListener('mouseup', this.handleDocumentMouseUp)
410+
411+
if (open) {
412+
_.invoke(this.ref.current, 'focus')
413+
}
409414
}
410415

411416
handleDocumentMouseUp = () => {

0 commit comments

Comments
 (0)