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

propagate click event to popover item activation callback #2703

Open
wants to merge 2 commits into
base: next
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,16 @@ export class PopoverItemDefault extends PopoverItem {

/**
* Called on popover item click
* @param event - click event
*/
public handleClick(): void {
public handleClick(event: Event): void {
if (this.isConfirmationStateEnabled && this.confirmationState !== null) {
this.activateOrEnableConfirmationMode(this.confirmationState);
this.activateOrEnableConfirmationMode(this.confirmationState, event);

return;
}

this.activateOrEnableConfirmationMode(this.params);
this.activateOrEnableConfirmationMode(this.params, event);
}

/**
Expand Down Expand Up @@ -289,11 +290,12 @@ export class PopoverItemDefault extends PopoverItem {
* Executes item's onActivate callback if the item has no confirmation configured
*
* @param item - item to activate or bring to confirmation mode
* @param event - pointer event that triggered item activation
*/
private activateOrEnableConfirmationMode(item: PopoverItemDefaultParams): void {
private activateOrEnableConfirmationMode(item: PopoverItemDefaultParams, event?: PointerEvent): void {
if (item.confirmation === undefined) {
try {
item.onActivate?.(item);
item.onActivate?.(item, event);
this.disableConfirmationMode();
} catch {
this.animateError();
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/popover/popover-abstract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ export abstract class PopoverAbstract<Nodes extends PopoverNodes = PopoverNodes>
/** Cleanup other items state */
this.itemsDefault.filter(x => x !== item).forEach(x => x.reset());

item.handleClick();
item.handleClick(event);

this.toggleItemActivenessIfNeeded(item);

Expand Down