Skip to content

fix: improve click handling for injected components in ThreeDotsMenu#538

Open
kulikp1 wants to merge 2 commits intonextfrom
feature/AdminForth/1394/click-area-is-broken--
Open

fix: improve click handling for injected components in ThreeDotsMenu#538
kulikp1 wants to merge 2 commits intonextfrom
feature/AdminForth/1394/click-area-is-broken--

Conversation

@kulikp1
Copy link
Copy Markdown
Collaborator

@kulikp1 kulikp1 commented Apr 6, 2026

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves how ThreeDotsMenu forwards clicks to injected dropdown components by attempting to trigger either an exposed click() method or the component’s root element click.

Changes:

  • Updated injectedComponentClick to call an injected component’s click() method when present.
  • Added a fallback to call componentRef.$el.click() when no click() method is exposed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +178 to +182
if (typeof (componentRef as any).click === 'function') {
(componentRef as any).click();
} else if (componentRef.$el && typeof componentRef.$el.click === 'function') {
componentRef.$el.click();
}
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling componentRef.$el.click() from within the parent @click handler can synchronously dispatch a new click event that bubbles back to this same handler, potentially causing recursive re-entry (and double-triggering actions). Consider adding a re-entrancy guard (e.g., ignore non-user-triggered events via event.isTrusted / a local flag) or dispatch a non-bubbling event / trigger a more direct component method so the synthetic click doesn’t re-invoke injectedComponentClick.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants