Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): clicking Menu close button should only close current menu #1160

Merged
merged 1 commit into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/common/src/extensions/menuFromCellBaseClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class MenuFromCellBaseClass<M extends CellMenu | ContextMenu> extends Men
isMenuClicked = true;
}

if (this.menuElement !== e.target && !isMenuClicked && !e.defaultPrevented || e.target.className === 'close' && parentMenuElm) {
if (this.menuElement !== e.target && !isMenuClicked && !e.defaultPrevented || (e.target.className === 'close' && parentMenuElm)) {
this.closeMenu(e, { cell: this._currentCell, row: this._currentRow, grid: this.grid });
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickColumnPicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class SlickColumnPicker {

/** Mouse down handler when clicking anywhere in the DOM body */
protected handleBodyMouseDown(e: DOMMouseOrTouchEvent<HTMLDivElement>) {
if ((this._menuElm !== e.target && !this._menuElm.contains(e.target)) || e.target.className === 'close') {
if ((this._menuElm !== e.target && !this._menuElm.contains(e.target)) || (e.target.className === 'close' && e.target.closest('.slick-column-picker'))) {
this._menuElm.setAttribute('aria-expanded', 'false');
this._menuElm.style.display = 'none';
}
Expand Down
2 changes: 1 addition & 1 deletion packages/common/src/extensions/slickHeaderMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export class SlickHeaderMenu extends MenuBaseClass<HeaderMenu> {
isMenuClicked = true;
}

if (this._menuElm !== e.target && !isMenuClicked && !e.defaultPrevented || e.target.className === 'close') {
if (this._menuElm !== e.target && !isMenuClicked && !e.defaultPrevented || (e.target.className === 'close' && parentMenuElm)) {
this.hideMenu();
}
}
Expand Down