bug: The ripple effect does not work on ion-item with click-event.
See original GitHub issueBug Report
Ionic version: [x] 4.x
Current behavior: The ripple effect does not work on ion-item with click-event. Please see the demo below in Related code section.
Expected behavior: All clickable ion-items should have a ripple effect. No need for the ion-ripple-effect element. If an item has a href attribut, it works. This should also work for click-event etc. If there is a case, you really do not want the ripple-effect on a specific ion-item with click-event, you should pass an attribute option. But by default, every clickable item should have this material button feedback. (UX)
Steps to reproduce: Please see the demo below in Related code section.
Related code:
<ion-list lines="none">
<ion-list-header>
<ion-label>Items</ion-label>
</ion-list-header>
<ion-item (click)="onClick()">
<ion-icon slot="start" color="medium" name="bug"></ion-icon>
<ion-label>I'm a click item.</ion-label>
</ion-item>
<ion-item (click)="onClick()">
<ion-icon slot="start" color="medium" name="bug"></ion-icon>
<ion-label>I'm a click item with ripple element.</ion-label>
<ion-ripple-effect type="bounded"></ion-ripple-effect>
</ion-item>
<ion-item href="">
<ion-icon slot="start" color="medium" name="checkmark"></ion-icon>
<ion-label>I'm a href element. Ripple works.</ion-label>
</ion-item>
</ion-list>
Ionic info:
Ionic:
Ionic CLI : 5.2.5 (C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.8.1
@angular-devkit/build-angular : 0.801.3
@angular-devkit/schematics : 8.1.3
@angular/cli : 8.1.3
@ionic/angular-toolkit : 2.0.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.1, (and 16 other plugins)
Utility:
cordova-res : not installed
native-run : 0.2.8
System:
Android SDK Tools : 26.1.1 (C:\Users\%USERNAME%\AppData\Local\Android\Sdk)
NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
bug: The ripple effect does not work on ion-item with ... - GitHub
No need for the ion-ripple-effect element. If an item has a href attribut, it works. This should also work for click-event etc. If...
Read more >Ionic/Angular ion-ripple-effect does not work - Stack Overflow
im using Ionic/Angular and im trying to add a ripple effect ( ion-ripple-effect ) but it does not work. I do exactly what...
Read more >How to use ion-ripple-effect? - Ionic Framework
Hello, I'm trying to use ionic-ripple-effect in ionic 4 according to ... However, it does not work (when clicking the div, nothing happens)....
Read more >Ionic V4 Issue Ripple Item - StackBlitz
name="bug"></ion-icon>. <ion-label>I'm a click item with ripple. element.</ion-label> ... ion-ripple-effect> ... ripple-element or click-event works. Like.
Read more >signature=4c44794979d36c3b2c6e1161877175aa,ionic-framework ...
5.3.5 (2020-10-07)Bug Fixesbutton: allow any element type to use the "icon-only" slot ... segment: do not show ripple effect if disabled via config...
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
I started to reply at the same time as Manu 🙂
In order to have a click effect on an item with an
onClick
/(click)
event you need to addbutton
to theion-item
. This is due to the fact that it is not possible for us to check if event listeners exist on elements. Here is our documentation for this: https://ionicframework.com/docs/api/item#clickable-itemsYou have to specify that ion-item is a button: