components icon indicating copy to clipboard operation
components copied to clipboard

Weird ripple effect

Open BenevidesLecontes opened this issue 10 years ago • 36 comments

Bug, feature request, or proposal:

[x] Bug

What is the expected behavior?

Expecting ripple effect on buttons

What is the current behavior?

On click ripple effect makes my button wide and ripple color appears like in image below

screen shot 2016-08-09 at 17 36 47 #### What are the steps to reproduce?
<button md-button md-ripple [md-ripple-color]="rippleColor" (click)="openSideNav($event)"  type="button"
                *ngIf="navigationUrl!=='/' && navigationUrl!=='/login'">
            <md-icon>menu</md-icon>
        </button>

Providing a Plunker (or similar) is the best way to get the team to see your issue.

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

Angular material alpha.7, chrome 52.0.2743.116 (64-bit) MacOS Sierra

Is there anything else we should know?

I'm trying to use the ripple effects on buttons am I missing something? I have my imports like this:

imports: [
        BrowserModule,
        MdCardModule,
        MdInputModule,
        MdIconModule,
        MdListModule,
        MdSidenavModule,
        MdToolbarModule,
        MdButtonModule,
        MdTabsModule,
        MdRippleModule,
        ReactiveFormsModule,
        MdMenuModule,
        FormsModule,
        RouterModule.forRoot([...routes], {})
    ]

BenevidesLecontes avatar Aug 09 '16 20:08 BenevidesLecontes

@BenevidesLecontes can you reproduce the issue in a pluker or similar? I don't follow on your steps to reproduce.

jelbourn avatar Aug 09 '16 20:08 jelbourn

@jelbourn git escaping the html, i update with what i'm using to make this ripple showing like this. And i'll try to make the plunker work with rc5, after that i'll try to update with plunker.

BenevidesLecontes avatar Aug 09 '16 21:08 BenevidesLecontes

cc @dozingcat

jelbourn avatar Aug 09 '16 21:08 jelbourn

md-button uses the ripple effect by default; you don't need to (and shouldn't) add a md-ripple attribute. You can set the disableRipple property to true to disable the ripple.

dozingcat avatar Aug 09 '16 21:08 dozingcat

@dozingcat but if i don't use the attribute md-ripple i can't change the ripple color, i need to disable it and then use the atribute to set the color?

BenevidesLecontes avatar Aug 09 '16 21:08 BenevidesLecontes

@jelbourn @dozingcat also md-ripple is creating scroll on my page after several clicks. I think this the cause. screen shot 2016-08-09 at 18 28 40

BenevidesLecontes avatar Aug 09 '16 21:08 BenevidesLecontes

If you get the Plunker set up I can take a look. There's currently not a supported way to change the ripple color on md-buttons. Disabling the existing ripple and adding your own might be a workaround, but that's not the intended use.

dozingcat avatar Aug 09 '16 22:08 dozingcat

@dozingcat any plunker with material alpha 7 and rc5 to fork? I Forked from here, but i can't make it work.

BenevidesLecontes avatar Aug 09 '16 23:08 BenevidesLecontes

+1 I'm experiencing exactly the same thing. And I only have 2 things: toolbar and button The button is inside the toolbar. Not sure if that matters or not. But what definitely matters is that from the beginning, the ripple works as expected inside the button, but if you click on the button, then the ripple area become really big.

sunshineo avatar Aug 10 '16 06:08 sunshineo

I think the folowing error is something related, after upgranding alpha.7 and angular rc.5 : Can't bind to 'md-ripple-trigger' since it isn't a known property of 'div'. ("*ngIf="isRippleEnabled()" class="md-button-ripple" [class.md-button-ripple-round]="isRoundButton()" [ERROR ->][md-ripple-trigger]="getHostElement()" [md-ripple-color]="isRoundButton() ? 'rgba(255, 255, 255, 0.2)"): MdButton@0:180

fernandogomesdf avatar Aug 10 '16 07:08 fernandogomesdf

@fernandogomesdf I encountered this error as well, but it disappeared as soon as I import MdButtonModule instead of using directives. See #973

colinfang avatar Aug 10 '16 12:08 colinfang

I have got the same problem.

Each click of the bottom inserts a

<div class="md-ripple-foreground md-ripple-fade-in"
 style="left: -12.3584px; top: -17.7959px; width: 64.7168px;
 height: 64.7168px; transition-duration: 0.1s;
 background-color: rgba(255, 255, 255, 0.2);"></div>

Into my html, and it keeps stacking and never goes away.

colinfang avatar Aug 10 '16 12:08 colinfang

@dozingcat Here is a plunker with RC.5 and alpha.7 to demonstrate the issue. Just press the button a couple of times and you'll see the vertical scrollbar appears. As said by @colinfang above, every time you press the button those divs stack up.

ivoviz avatar Aug 10 '16 13:08 ivoviz

@dozingcat @ivoviz and also notice in this plunker, no ripple effect after all.

BenevidesLecontes avatar Aug 10 '16 14:08 BenevidesLecontes

The problem may be that the ripples depend on styles in core.css, which needs to be included in the page (for example https://github.com/angular/material2/blob/master/src/demo-app/index.html#L17 in the demo app). @jelbourn was there going to be a way to automatically include this?

dozingcat avatar Aug 10 '16 14:08 dozingcat

@dozingcat Indeed, I can confirm that adding core.css solves every problem, although it would be nice to have it automatically included somehow. (FYI: same thing happening when overlay.css is not included, the menu element (and probably others as well) is just positioned totally off.)

ivoviz avatar Aug 10 '16 14:08 ivoviz

@ivoviz adding core.css solved the scroll problem?

BenevidesLecontes avatar Aug 10 '16 19:08 BenevidesLecontes

@BenevidesLecontes Yes it did for me.

ivoviz avatar Aug 10 '16 19:08 ivoviz

This Ripple effect doesn't seem reasonable, I can't even seen the effect on dark background.

BenevidesLecontes avatar Aug 11 '16 16:08 BenevidesLecontes

@colinfang thank you, it was my mistake

fernandogomesdf avatar Aug 11 '16 19:08 fernandogomesdf