I have designed an ionic component that has an x button in the top right corner.
tapping the buttton results in the component emitting an event that triggers a function call in the parent which changes a boolean (which determines if the child component is show) to false, removing the child.
My issue is that when a user taps on the x it appears to remove the component and then pass the tap along to the component that replaces it. This has the undesireable effect of the user being launched into a section of the app that they were not trying to access.
I was under the impression that it’s better to use (tap) than (click) ionic apps. After all it still is a tap right? Is this how it’s supposed to behave?
Honestly, I’m not sure how it’s supposed to behave.
I’ve always just used (click), as that’s what the docs and community have always recommended. So while it may be a little conceptually counter-intuitive, it’s the recommended way.
Yeah, you’re right on that one. (tap) is used on div’s for performance reasons I think, but it’s not a necessity. I tried recreating the issue in an app, but (tap) isn’t causing any unexpected behavior. I’m testing in the browser. @golear, is this issue coming up testing in the browser, actual device, emulator?
Now i’m just really curious as to why there’s a difference in outcome.
On a side-note, wouldn’t logic dictate that (tap) ought to be used on an element that is made “tappable”? Otherwise, would the element not be made “clickable”?
Maybe not, but an entertaining thought at the least.
I would concur. (click) is definitely an angular concept, so I’d imagine that they just continued that tradition. Plus with their move to including PWA having click as a “catch all” makes a bit more sense imo.