Skip to content

Commit

Permalink
Check if target is a child of parent node
Browse files Browse the repository at this point in the history
Signed-off-by: Itay Dafna <[email protected]>
  • Loading branch information
ibdafna committed Nov 2, 2022
1 parent cdc8508 commit ca4fae7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions js/core/filterMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,10 @@ export class InteractiveFilterDialog extends BoxPanel {
*/
protected _evtMouseDown(event: MouseEvent) {
// Close the menu if a click is detected anywhere else
if (!ElementExt.hitTest(this.node, event.clientX, event.clientY)) {
// FireFox will register a click event for an ephemeral Option element,
// and the hitTest will have x,y coordinates of (0,0).
if ((event.target as HTMLElement).tagName === 'OPTION') {
return;
}
if (
!ElementExt.hitTest(this.node, event.clientX, event.clientY) &&
!this.node.contains(event.target as HTMLElement)
) {
this.close();
}
}
Expand Down

0 comments on commit ca4fae7

Please sign in to comment.