Skip to content

Commit

Permalink
fix(common): rollback event capture causing multiple calls (#1168)
Browse files Browse the repository at this point in the history
- enabling `capture` for event has the side effect of calling the listener multiple times instead of a single time like we want
  • Loading branch information
ghiscoding committed Nov 1, 2023
1 parent 550f103 commit 90876c9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickCellMenu.ts
Expand Up @@ -137,7 +137,7 @@ export class SlickCellMenu extends MenuFromCellBaseClass<CellMenu> {
}

// Hide the menu on outside click.
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener, { capture: true });
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickContextMenu.ts
Expand Up @@ -142,7 +142,7 @@ export class SlickContextMenu extends MenuFromCellBaseClass<ContextMenu> {
}

// Hide the menu on outside click.
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener, { capture: true });
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener);
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickGridMenu.ts
Expand Up @@ -221,7 +221,7 @@ export class SlickGridMenu extends MenuBaseClass<GridMenu> {
this.translateTitleLabels(this.sharedService.gridOptions.gridMenu);

// hide the menu on outside click.
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener, { capture: true });
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener);

// destroy the picker if user leaves the page
this._bindEventService.bind(document.body, 'beforeunload', this.dispose.bind(this) as EventListener);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickHeaderMenu.ts
Expand Up @@ -84,7 +84,7 @@ export class SlickHeaderMenu extends MenuBaseClass<HeaderMenu> {
this.grid.setColumns(this.grid.getColumns());

// hide the menu when clicking outside the grid
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener, { capture: true });
this._bindEventService.bind(document.body, 'mousedown', this.handleBodyMouseDown.bind(this) as EventListener);
}

/** Dispose (destroy) of the plugin */
Expand Down

0 comments on commit 90876c9

Please sign in to comment.