-
Notifications
You must be signed in to change notification settings - Fork 64
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
a
tags without href
generate a navigation event
#34
Comments
A good example for that is an in-page-anchor. <a href="#someAnchor">Click here to jump to anchor</a>
<!-- An anchor on the page without href -->
<a name="someAnchor"></a> |
@sporto If you want to test all sorts of behaviors out, I recommend this gist https://gist.github.com/Pilatch/c1b6e5d925c6479a0b2e53892fa2dca3 I have discovered the culprit, and it's not in elm/browser. It's in elm/virtual-dom. Pull request created for the fix - elm/virtual-dom#142 |
For the record, it maps to |
for anyone here looking to get past this thing. The following delivers the desired behavior onClickAnchor :: msg -> List (Attribute msg)
onClickAnchor msg = [ preventDefaultOn "click" <| Json.succeed (msg,True), href "#" ] |
Just ran into this again. The current behavior is really bad. It basically makes using in page anchor's useless with |
How to use it? Could you please share an example? |
When using Browser.application. If you have an
a
which doesn't have anhref
, Elm will generate a navigation event.Reproduction here: https://github.com/sporto/repro-elm-application-a-tag/blob/master/src/Main.elm
This seems like a bug,
a
tag is not supposed to be a link unless it has ahref
.https://www.w3.org/TR/html5/text-level-semantics.html#the-a-element
The text was updated successfully, but these errors were encountered: