question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: The ripple effect does not work on ion-item with click-event.

See original GitHub issue

Bug 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. demo

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>

Demo Stackblitz

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:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brandyscarneycommented, Sep 5, 2019

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 add button to the ion-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-items

2reactions
manucorporatcommented, Sep 5, 2019

You have to specify that ion-item is a button:

<ion-item button (click)="doSomething()">
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found