-
Notifications
You must be signed in to change notification settings - Fork 80
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
Fixes #103 Html.map + blur event on DOM removal makes impossible states possible #166
base: master
Are you sure you want to change the base?
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; |
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!
@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) |
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 BlurA
triggered by the blur eventMore details about the problem can be found on #103.
This should also fix elm/html#119 as mentioned on #105.