Fixes #103 Html.map + blur event on DOM removal makes impossible states possible#166
Open
decioferreira wants to merge 2 commits intoelm:masterfrom
Open
Fixes #103 Html.map + blur event on DOM removal makes impossible states possible#166decioferreira wants to merge 2 commits intoelm:masterfrom
decioferreira wants to merge 2 commits intoelm:masterfrom
Conversation
…tates possible
|
@decioferreira This PR misses the case when no var oldHandler = oldCallback.__handler;
if (oldHandler.$ === newHandler.$)
{
oldCallback.__handler = newHandler;
oldCallback.__eventNode = eventNode.__tagger ? {
__tagger: eventNode.__tagger,
__parent: eventNode.__parent
} : eventNode;
continue;
}
domNode.removeEventListener(key, oldCallback);
// and
callback.__handler = initialHandler;
callback.__eventNode = eventNode.__tagger ? { __tagger: eventNode.__tagger, __parent: eventNode.__parent } : eventNode;
return callback; |
Contributor
Author
|
hi @matsjoyce, thank you so much for your comment. Any chance you could share an SSCCE which shows the problem that your change would allow to fix? thanks in advance |
|
With the following code, click on the input and then somewhere else (focus then unfocus). module Main exposing (main)
import Html as H
import Html.Events as HE
import Browser
type alias Model = {}
type Msg = Blurred
main =
Browser.sandbox
{ init = {}
, update = update
, view = view
}
update msg model = {}
view model = H.input [HE.onBlur Blurred] []In the console I get: |
Pointed out by @matsjoyce on the PR, thanks!
Contributor
Author
|
@matsjoyce I've updated the code with your fix, thank you! |
|
Thanks for opening this @decioferreira. This has been affecting us as well. How have you addressed the problem in the meantime? |
|
Just a note: I experience this bug only in Safari now, not Chrome or Firefox (with a Mouse Leave event) |
ahankinson
added a commit
to elm-janitor/virtual-dom
that referenced
this pull request
Nov 20, 2025
fixes elm#187 fixes elm#182 fixes elm/html#44 fixes elm/browser#121 fixes elm/browser#66 fixes elm#62 fixes elm#127 fixes elm#147 fixes elm#159 fixes elm#105 fixes elm#162 fixes elm#171 fixes elm#175 fixes elm#178 fixes elm#180 fixes elm#183 fixes elm#189 fixes elm#166 fixes elm/html#160 fixes elm/html#177 fixes elm/compiler#2069
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated SSCCE: https://ellie-app.com/8cPfM8xMj7Za1
This issue happens in chrome, and not firefox (as mentioned on #103). To see the issue on the SSCCE above:
MsgB BlurAtriggered by the blur eventMore details about the problem can be found on #103.
This should also fix elm/html#119 as mentioned on #105.