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

Ensure correct this context for addMembership function to call the blur method correctly. Fixes #10555 #10560

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Deeptanshu-sankhwar
Copy link

Fixes issue #10555

  • Pass the this reference explicitly to the addMembership function to ensure the correct context is available.
  • Resolved an issue where this was undefined due to implicit context binding in event handlers.
  • Updated acceptEntity to pass the triggering DOM element explicitly as a parameter.

Screen Recording 2024-11-27 at 6 25 10 AM

Comment on lines +174 to +176
if (domElement && typeof domElement.blur === 'function') {
domElement.blur(); // avoid keeping focus on the button
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a defensive fix, but since addMembership is only called from one place, I think it would be cleaner to move this blur call to the caller, or even replace this with a closure that blurs the element, which would explicitly be in scope:

.on('accept', acceptEntity)

As it is, if acceptEntity has to bail for some reason, it won’t blur the element, which might result in the menu getting stuck on screen.

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