v1.0.0-beta : ScrollSpy not working properly when clicking on an <i>-element.
See original GitHub issueExpected Behavior
Click on Button scrolls Section below into view.
Current Behavior
I have a button [a.btn-large] witch should scoll to a section below in the document.
<a href="#contact" class="waves-effect waves-light btn-large"><i class="material-icons left">message</i>[link-text]</a>
[snip]
<section id="contact" class="contact fixed-bg scrollspy">[content]</section>
if i click on the icon instead of the link-text it just jumps, without scrolling, to the ancor.
Possible Solution
Line#6150 in Materialize,js:
You’re comparing the $trigger to 'a[href="#' + scrollspy.$el.attr('id') + '"]'
to start scrolling.
But if the $trigger is an <i>
inside the <a>
nothing happens.
Your Environment
Chrome 65.0.3325.181 JQuery 3.1.1 Materialize 1.0.0-beta
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:7 (1 by maintainers)
Top Results From Across the Web
bootstrap 4 beta scrollspy not working - Stack Overflow
I'm using the javascript file from this scrolling nav template to scroll down to a section when you click a link. This works,...
Read more >node_modules/bootstrap-vue/CHANGELOG.md - GitLab
activeElement if no return focus element provided (#3033) (e5c0aa5) ... v-b-scrollspy: support when vue-router is in hash based route mode (closes #2722) ...
Read more >Scrollspy - Bootstrap
Automatically update Bootstrap navigation or list group components based on scroll position to indicate which link is currently active in the viewport.
Read more >Popovers · JCU Web Framework
Zero-length title and content values will never show a popover. Specify container: 'body' to avoid rendering problems in more complex components (like our...
Read more >aurelia/Discuss - Gitter
Can you show the element? MisanthropeGirl. @MisanthropeGirl. Dec 06 2016 15:21 UTC. No function, just mailto:${json.email}. Andrew Stoker. @AStoker.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Experienced the same issue today. For a quick workaround I added
style="pointer-events:none;"
to<i>
same thing happens when the link has an svg. I did some digging and it seems like its because of this:
https://github.com/Dogfalo/materialize/blob/e5f686b87bd95eeec2b9c7cac8e0eb7241f0ccaf/js/scrollspy.js#L108
normally
$target
would be theanchor
but for some reason, it is set to thesvg
ori
element (could be others). The following css fixes the issue for me:also found this great article that demonstrates this problem: https://css-tricks.com/links-inline-svg-staying-target-events/