Comments (6)
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 "#" ]
from browser.
For the record, it maps to External ""
from browser.
@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
from browser.
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>
from browser.
Just ran into this again. The current behavior is really bad. It basically makes using in page anchor's useless with Browser.application
, because you don't want the page to reload there. It would be such an easy fix to just exclude links without an href
attribute from the special treatment.
from browser.
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 "#" ]
How to use it? Could you please share an example?
from browser.
Related Issues (20)
- Debugger crashes when msg is triggered with large list in model HOT 2
- Broken links in `Browser.application` with prerendered content HOT 1
- Browser.Dom.Focus returns an Ok on disabled element
- If target "_self" is set, the url is loaded even if it's an internal request
- Not explained that pushUrl doesn't need whole URL to work
- Clipboard API support
- Selection API support
- A platform detection API
- Runtime exception in compiled elm script
- Expose "on" -function HOT 2
- Alike javascript getBBox() function
- getViewport returns incorrect viewport height HOT 1
- Ability to distinguish source of url change in onUrlChange
- Elm Application Crashes ... using a ScreenReader
- Developer experience: Not always clear how to init from JS
- `keypress` event is deprecated
- navigator.userAgent changing soon in Chrome HOT 1
- Browser.Navigation.load doesn't actually cause a page load when url contains an #
- Support View Transitions API HOT 1
- Debugger stack overflow crash when msg triggered with large Set in model
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browser.