material-design-lite icon indicating copy to clipboard operation
material-design-lite copied to clipboard

Ripple effect breaks buttons on iOS 13

Open HannesHentzschel opened this issue 6 years ago • 18 comments

Bug

iOS 13 was released 2 days ago. Here is an issue that I found, which did not happen with the previous iOS version.

What MDL Version are you using? (please be specific, e.g. major.minor.patch)

1.3.0

What browser(s) is this bug affecting (including version)?

Safari (most current version)

What OS (and version) are you using?

iOS 13

What are the steps to reproduce the bug?

Try it with the following html:

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
        <link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
        <script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
    </head>
    <body>

        <button onclick="alert('click')" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--accent mdl-button--raised">
                Works only sometimes
        </button>
        <button onclick="alert('click')" class="mdl-button mdl-button--accent mdl-button--raised">
                Works every time
        </button>
    </body>
</html>

plunker mobile friendly punker

What is the expected behavior?

The alert for "onclick" should always trigger when I tap the button.

What is the actual behavior?

When using the classes mdl-js-button mdl-js-ripple-effect the onclick does not trigger reliably.

Any other information you believe would be useful?

Once the click on the ripple button worked, repeated clicks will also work. You need to click somewhere else to reproduce the problem again. It seems this problem gets more prominent, when the page where the button is used is more resource intensive. In my app it takes like 5-10 taps to trigger the button.

HannesHentzschel avatar Sep 21 '19 09:09 HannesHentzschel

I can confirm that. The same problem I have in an app with the WebView component on iOS 13.

chriscorns avatar Sep 23 '19 09:09 chriscorns

I understand you're seeing a problem in an existing application after testing on the latest iOS release. MDL is no longer maintained. Please update your systems as you can to Material Components for Web.

Since this was seemingly working in all previous versions of iOS, it would appear that this is a bug introduced by a change in WebKit. That should probably be reported to them so they can triage if they broke something unexpectedly.

Thank you.

Garbee avatar Sep 23 '19 17:09 Garbee

Having the same issue. Reported this issue on WebKit BugZilla. Seems others are having related issues.

et-nat1995 avatar Oct 11 '19 14:10 et-nat1995

@et-nat1995 Can you post a link to the issue you reported on WebKit BugZilla. If anyone finds a workaround, please post it. I would think this iOS issue would affect more than just mdl, but I'm having a hard time finding others talking about the issue.

jscadden avatar Oct 16 '19 23:10 jscadden

I think this is the bug report: https://bugs.webkit.org/show_bug.cgi?id=202802 My workaround is to remove the ripple module incl. JavaScript (which cause the bug) in my project and to replace the ripple effect with a custom css inspired by https://codepen.io/finnhvman/pen/jLXKJw.

chriscorns avatar Oct 17 '19 07:10 chriscorns

@jscadden I am experiencing a related issue in our hybrid native app. Only on certain :active psuedo-classes do I experience the onclick handlers having inconsistent behavior. I'm using React, however, and nothing related to material-design-lite (so this is likely a WebKit bug)

aanich-assf avatar Oct 17 '19 18:10 aanich-assf

@chriscorns Yeah that is it. I pretty much had to remove all places I was using the ripple effect.

et-nat1995 avatar Oct 17 '19 21:10 et-nat1995

Experiencing this issue too. Thanks @chriscorns for the codepen, looks good enough. I've just removed the ripple module to get around this issue for now but a solution would be great.

lockstockd avatar Oct 18 '19 19:10 lockstockd

Same issue here. Im removing all mdl-js-ripple-effect now as a workaround... Checkboxes and radio-buttons don't seem to be affected, only mdl-buttons.

klemensz avatar Oct 24 '19 09:10 klemensz

For my OpenHAB installation, I have developed a work-around for this problem, which is coming from the "mdl-ripple" style. In this style there are two entries (among others)

.mdl-ripple { background: #000; opacity: 0; }

which iOS 13 doesn't like. However, if you reverse the two, there is no visual difference (opacity of 0% and transparent background are actually both transparent), but the buttons work again on iOS 13:

.mdl-ripple { background: transparent; opacity: 1; }

Maybe this is also helpful for others using MDL.

tom-kaltofen avatar Nov 13 '19 20:11 tom-kaltofen

hi @tom-kaltofen , I already test your workaround, buttons work but styles for tabs and buttons got damaged.

Screen Shot 2019-11-13 at 8 07 35 PM

iojancode avatar Nov 14 '19 01:11 iojancode

@iojancode That's strange, in OpenHAB there is no visual difference (in iOS and also on Windows). Maybe OpenHAB is using MDL in a different way. How does it look if you use a very small value for opacity and don't change the background, e.g.

.mdl-ripple { background: #000; opacity: 0.001; }

or even a smaller value?

tom-kaltofen avatar Nov 14 '19 22:11 tom-kaltofen

I can confirm this happens on:

http://www.mushroom-man.com/signup

This only started to happen when I upgraded my iPhone 8+ from iOS 12.x to iOS 13.x

charlesr1971 avatar Dec 31 '19 12:12 charlesr1971

@iojancode How does it look if you use a very small value for opacity and don't change the background

You sir, are a genius!

This worked for me...

charlesr1971 avatar Dec 31 '19 13:12 charlesr1971

@iojancode That's strange, in OpenHAB there is no visual difference (in iOS and also on Windows). Maybe OpenHAB is using MDL in a different way. How does it look if you use a very small value for opacity and don't change the background, e.g.

.mdl-ripple { background: #000; opacity: 0.001; }

or even a smaller value?

Now it works!!! thank you

iojancode avatar Apr 08 '20 23:04 iojancode

@iojancode That's strange, in OpenHAB there is no visual difference (in iOS and also on Windows). Maybe OpenHAB is using MDL in a different way. How does it look if you use a very small value for opacity and don't change the background, e.g.

.mdl-ripple { background: #000; opacity: 0.001; }

or even a smaller value?

Genius! this worked for me, thank you!

jlsanchezfr avatar May 01 '20 01:05 jlsanchezfr

What is these links used for.

KarthikeyanUTH avatar Feb 22 '23 15:02 KarthikeyanUTH

@jscadden I am experiencing a related issue in our hybrid native app. Only on certain :active psuedo-classes do I experience the onclick handlers having inconsistent behavior. I'm using React, however, and nothing related to material-design-lite (so this is likely a WebKit bug)

KarthikeyanUTH avatar Feb 22 '23 15:02 KarthikeyanUTH