Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/core): ripples persisting when container is removed from DOM while fading-in #24482

Merged

Conversation

devversion
Copy link
Member

Follow-up to 65fb5f4.

We recently changed how animations are handled in the ripple. As part of this change
we accidentally broke the select <> ripple interaction. The select is special because
the option panel is removed from the DOM as soon as an option got clicked.

An option click will trigger a ripple that will usually still fade-in when the
panel is removed. Currently such ripples never will complete because the transitionend
event does not fire once removed from DOM. We should destroy the ripples when the
transition is canceled (e.g. through DOM removal).

@devversion devversion added the dev-app preview When applied, previews of the dev-app are deployed to Firebase label Feb 25, 2022
@devversion devversion force-pushed the fix/ripple-transition-cancel branch from 612e446 to e6bd320 Compare February 25, 2022 13:53
@github-actions
Copy link

github-actions bot commented Feb 25, 2022

@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Feb 25, 2022
@devversion devversion marked this pull request as ready for review February 25, 2022 14:02
@devversion devversion requested review from a team, jelbourn and crisbeto as code owners February 25, 2022 14:02
@devversion devversion added the target: minor This PR is targeted for the next minor release label Feb 25, 2022
src/material/core/ripple/ripple-renderer.ts Show resolved Hide resolved
// If the transition is cancelled (e.g. due to DOM removal), we destroy the ripple
// directly as otherwise we would keep it part of the ripple container forever.
// https://www.w3.org/TR/css-transitions-1/#:~:text=no%20longer%20in%20the%20document.
ripple.addEventListener('transitioncancel', () => this._destroyRipple(rippleRef));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these event listeners be removed once the ripple is destroyed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good question. Not sure. If the ripple element is not referenced anywhere, it shouldn't matter?

… DOM while fading-in

Follow-up to 65fb5f4.

We recently changed how animations are handled in the ripple. As part of this change
we accidentally broke the select <> ripple interaction. The select is special because
the option panel is removed from the DOM as soon as an option got clicked.

An option click will trigger a ripple that will usually still fade-in when the
panel is removed. Currently such ripples never will complete because the `transitionend`
event does not fire once removed from DOM. We should destroy the ripples when the
transition is canceled (e.g. through DOM removal).
@devversion devversion force-pushed the fix/ripple-transition-cancel branch from e6bd320 to 1f322eb Compare February 25, 2022 15:39
@andrewseguin andrewseguin merged commit e86be88 into angular:master Feb 25, 2022
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker dev-app preview When applied, previews of the dev-app are deployed to Firebase target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants