Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
Button in Tappable ListItem issue
-
I have a
Button
in a tappableListItem
. How can I prevent theListItem
to “react” to touch when theButton
is pressed? I’ve tried catching and callingpreventDefault()
andstopPropagation()
on the events returned byonTouchTap
andonMouseDown
on theButton
but without success… TheListItem
still reacts when pressing theButton
.
-
@zabojad Try
stopPropagation()
withmousedown
andtouchstart
events :+1:
I think we will add some kind ofprevent-tap
attribute to fix this properly.var button = document.querySelector('ons-button'); var prevent = function(event) { event.stopPropagation(); }; button.addEventListener('mousedown', prevent); button.addEventListener('touchstart', prevent);
-
For anyone else wondering about the same thing => https://github.com/OnsenUI/OnsenUI/pull/2267