Skip to content

Commit 3cd86e8

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 24e47ca commit 3cd86e8

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
@@ -404,10 +404,15 @@ export default class Dropdown extends Component {
404404

405405
handleMouseDown = (e) => {
406406
debug('handleMouseDown()')
407+
const { open } = this.state
407408

408409
this.isMouseDown = true
409410
_.invoke(this.props, 'onMouseDown', e, this.props)
410411
document.addEventListener('mouseup', this.handleDocumentMouseUp)
412+
413+
if (open) {
414+
_.invoke(this.ref.current, 'focus')
415+
}
411416
}
412417

413418
handleDocumentMouseUp = () => {

0 commit comments

Comments
 (0)