Framwork-core: activableElement and rippleWave should be FIFO queue instead
- Framework7 version: [e.g. 3.0.0] 3.x ~ 4.x all
- Platform and Target: [e.g. iOS 11 Cordova app, or Android 8 Chrome browser] md theme or ios theme with ripple enabled
- Live Link or JSFiddle: PREFERABLY (IF YOU WANT YOUR ISSUE TO BE RESOLVED ASAP). You can start from forking the following JSFiddle template: JSFiddle
Describe the bug
https://github.com/framework7io/framework7/blob/1a009d95bb18b727a0471f645fed98f1f80c3276/src/core/modules/touch/touch.js#L29-L35 The activableElement and rippleWave is a singlaton here. However, this is not the natual of this function, user may click fast enough to cause the framework7 add a new ripple / active lement before the old one has gone
sequences like the following will result in unremoveable ripple
touch 1 add ripple ----------> remove ripple
touch 2 add ripple ------------> remove ripple
The ripple element caused by touch one has got overriden by touch two, and remove ripple function will only remove the second ripple as it is the only ripple element exist
To Reproduce
Steps to reproduce the behavior:
- Just click betwwen some element that has ripple fast enough
Expected behavior
It removes
Actual Behavior
It keeps
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Change the two field to a array and use fifo method to handle these ripples fixed the issue in my test push a element to array when add, shift away when remove simply fixes these bugs
Can't replicate the issue. Would be good to have more details on how to replicate it
It is root cause of #2418
the ripple wave got wipe out without remove element first, cause button to freeze
Still, i can't replicate it. Can anyone else see this issue in latest 4.x.x ?
Yes, for example:
-
OnePlus 5T - Android 9
-
Chrome 73
The problem is this part of the code:
...
Utils.nextFrame(function () {
if (!ripple || !ripple.$rippleWaveEl) { return; }
ripple.$rippleWaveEl.transform(ripple.rippleTransform);
});
...
Utils.nextFrame() calls requestAnimationFrame() and the return value is an id. That id must be passed to Utils.cancelAnimationFrame(id) to cancel the request.
The same for this part:
...
Utils.nextFrame(function () {
$rippleWaveEl
.addClass('ripple-wave-out')
.transform(rippleTransform.replace('scale(1)', 'scale(1.01)'));
...
The other problems are:
-
current ripple wave isn't removed from the DOM before creating a new one.
-
current active state isn't removed before setting the new one.