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

bug(mat-button): Ripple effect missing when using encapsulation: ShadowDom #29011

Closed
1 task
jdkultur opened this issue May 7, 2024 · 2 comments · Fixed by #29015
Closed
1 task

bug(mat-button): Ripple effect missing when using encapsulation: ShadowDom #29011

jdkultur opened this issue May 7, 2024 · 2 comments · Fixed by #29015
Assignees
Labels
area: material/button P4 A relatively minor issue that is not relevant to core functions

Comments

@jdkultur
Copy link

jdkultur commented May 7, 2024

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using encapsulation: ViewEncapsulation.ShadowDom in a component, the ripple effect on any material buttons is missing.

Reproduction

StackBlitz link: https://stackblitz.com/edit/stackblitz-starters-ggkhap?file=src%2Fshadow-buttons.component.ts
Steps to reproduce:

  1. click the buttons

Expected Behavior

All four buttons show a ripple effect.

Actual Behavior

Only the buttons using the default encapsulation has a ripple, and the ones in the shadow dom does not.
shadow-ripple.webm

Environment

Angular CLI: 17.3.6
Node: 18.18.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.3.6
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, material, platform-browser, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.6
@angular-devkit/build-angular   17.3.6
@angular-devkit/core            17.3.6
@angular-devkit/schematics      17.3.6
@schematics/angular             17.3.6
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.5
@jdkultur jdkultur added the needs triage This issue needs to be triaged by the team label May 7, 2024
@amysorto amysorto added P4 A relatively minor issue that is not relevant to core functions area: material/button and removed needs triage This issue needs to be triaged by the team labels May 7, 2024
@crisbeto crisbeto self-assigned this May 8, 2024
crisbeto added a commit to crisbeto/material2 that referenced this issue May 8, 2024
Fixes the following issues that prevented the button ripples from being loaded in the shadow DOM:
* We weren't resolving the event target properly.
* We were using `click` as a fallback which happens too late for the very first ripple. These changes switch to `mousedown`.

Fixes angular#29011.
@crisbeto
Copy link
Member

crisbeto commented May 8, 2024

A couple of notes:

  1. Our code had an issue that prevented it from working in the shadow DOM. I've sent a fix at fix(material/core): ripple loader not working in shadow DOM #29015.
  2. Even once our issue is fixed, your demo won't work because the ripple structural styles (included via the mat.core mixin) need to be inside the shadow DOM. We can't do much about this so you'll have to ensure that the styles are in the correct place.

crisbeto added a commit that referenced this issue May 9, 2024
Fixes the following issues that prevented the button ripples from being loaded in the shadow DOM:
* We weren't resolving the event target properly.
* We were using `click` as a fallback which happens too late for the very first ripple. These changes switch to `mousedown`.

Fixes #29011.
crisbeto added a commit that referenced this issue May 9, 2024
Fixes the following issues that prevented the button ripples from being loaded in the shadow DOM:
* We weren't resolving the event target properly.
* We were using `click` as a fallback which happens too late for the very first ripple. These changes switch to `mousedown`.

Fixes #29011.

(cherry picked from commit 7553e1c)
@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 Jun 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/button P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants