Skip to content

Commit

Permalink
Hide completer when changing notebook tabs (#14534)
Browse files Browse the repository at this point in the history
* Change mousedown event to pointerdown to hide the widget when there are other mousedown events with preventDefault and stopPropogation

* Remove debug statements

---------

Co-authored-by: root <root@DESKTOP-HHK0CPS>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
  • Loading branch information
3 people committed Oct 7, 2023
1 parent 3c3c65a commit 0b33a5c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/completer/src/widget.ts
Expand Up @@ -207,8 +207,8 @@ export class Completer extends Widget {
case 'keydown':
this._evtKeydown(event as KeyboardEvent);
break;
case 'mousedown':
this._evtMousedown(event as MouseEvent);
case 'pointerdown':
this._evtPointerdown(event as PointerEvent);
break;
case 'scroll':
this._evtScroll(event as MouseEvent);
Expand Down Expand Up @@ -251,7 +251,7 @@ export class Completer extends Widget {
*/
protected onAfterAttach(msg: Message): void {
document.addEventListener('keydown', this, USE_CAPTURE);
document.addEventListener('mousedown', this, USE_CAPTURE);
document.addEventListener('pointerdown', this, USE_CAPTURE);
document.addEventListener('scroll', this, USE_CAPTURE);
}

Expand All @@ -260,7 +260,7 @@ export class Completer extends Widget {
*/
protected onBeforeDetach(msg: Message): void {
document.removeEventListener('keydown', this, USE_CAPTURE);
document.removeEventListener('mousedown', this, USE_CAPTURE);
document.removeEventListener('pointerdown', this, USE_CAPTURE);
document.removeEventListener('scroll', this, USE_CAPTURE);
}

Expand Down Expand Up @@ -653,7 +653,7 @@ export class Completer extends Widget {
/**
* Handle mousedown events for the widget.
*/
private _evtMousedown(event: MouseEvent) {
private _evtPointerdown(event: PointerEvent) {
if (this.isHidden || !this._editor) {
return;
}
Expand Down

0 comments on commit 0b33a5c

Please sign in to comment.