Skip to content

Commit

Permalink
close menu if focus moves to trigger (#3255)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Comeau authored Jun 10, 2020
1 parent 62eff11 commit caa6323
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { SelectClassNameContract } from "@microsoft/fast-components-class-name-c
import Foundation, { HandledProps } from "@microsoft/fast-components-foundation-react";
import {
classNames,
isHTMLElement,
keyCodeArrowDown,
keyCodeArrowLeft,
keyCodeArrowRight,
Expand Down Expand Up @@ -641,7 +642,9 @@ class Select extends Foundation<SelectHandledProps, SelectUnhandledProps, Select
this.state.isMenuOpen &&
!this.props.multiselectable &&
this.rootElement.current !== null &&
!this.rootElement.current.contains(event.relatedTarget as Element)
(!this.rootElement.current.contains(event.relatedTarget as Element) ||
(isHTMLElement(event.relatedTarget) &&
(event.relatedTarget as HTMLElement).id === this.triggerId))
) {
this.toggleMenu(false);
}
Expand Down

0 comments on commit caa6323

Please sign in to comment.