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

Clear lastButtonClicked ref if it was removed from the DOM #1785

Merged
merged 1 commit into from Oct 7, 2023

Conversation

Telroshan
Copy link
Collaborator

This addresses #1749

  • htmx uses an internal data to keep track of the last clicked button in a form
  • it relies on the focusout event to clear that reference
  • on Chrome, the focusout event gets called when the element is swapped and removed from the DOM
  • however on Firefox for some reason, the event isn't fired at all, so the reference is never cleared, the internal state still has a reference to the removed button as the last clicked button, thus its values gets included, until you click out to focusout the form

This change adds a check right before using that lastButtonClicked property, making sure the referenced button is still in the DOM

@Telroshan Telroshan changed the title [Bugfix] #1749 - clear lastButtonClicked ref if it was removed from the DOM [Bugfix] Clear lastButtonClicked ref if it was removed from the DOM Sep 11, 2023
@Telroshan Telroshan added bug Something isn't working ready for review Issues that are ready to be considered for merging labels Sep 20, 2023
@alexpetros alexpetros changed the title [Bugfix] Clear lastButtonClicked ref if it was removed from the DOM Clear lastButtonClicked ref if it was removed from the DOM Sep 26, 2023
@1cg 1cg merged commit 332e898 into bigskysoftware:dev Oct 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready for review Issues that are ready to be considered for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants