Skip to content

Weird ripple effect #972

Closed
Closed

Description

@BenevidesLecontes

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], {})
    ]

Activity

  1. jelbourn commented on Aug 9, 2016

    @jelbourn
    Contributor

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

  2. BenevidesLecontes commented on Aug 9, 2016

    @BenevidesLecontes
    Author

    @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.

  3. jelbourn commented on Aug 9, 2016

    @jelbourn
    Contributor
  4. dozingcat commented on Aug 9, 2016

    @dozingcat
    Contributor

    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.

  5. BenevidesLecontes commented on Aug 9, 2016

    @BenevidesLecontes
    Author

    @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?

  6. BenevidesLecontes commented on Aug 9, 2016

    @BenevidesLecontes
    Author

    @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

  7. dozingcat commented on Aug 9, 2016

    @dozingcat
    Contributor

    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.

  8. BenevidesLecontes commented on Aug 9, 2016

    @BenevidesLecontes
    Author

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

  9. sunshineo commented on Aug 10, 2016

    @sunshineo

    +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.

  10. fernandogomesdf commented on Aug 10, 2016

    @fernandogomesdf

    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

  11. colinfang commented on Aug 10, 2016

    @colinfang

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

  12. colinfang commented on Aug 10, 2016

    @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.

  13. ivoviz commented on Aug 10, 2016

    @ivoviz

    @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.

  14. BenevidesLecontes commented on Aug 10, 2016

    @BenevidesLecontes
    Author

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

  15. dozingcat commented on Aug 10, 2016

    @dozingcat
    Contributor

    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?

  16. 11 remaining items

  17. jelbourn commented on Aug 18, 2016

    @jelbourn
    Contributor

    You should load the css files with a <link> element rather than styleUrls in a component.

    alpha.7-4 isn't all the way up to master; it only includes very minor changes that won't affect most users (in this case fixing an issue with ngc running on the ripple).

  18. xhite commented on Aug 18, 2016

    @xhite

    @jelbourn thanks it works when loading globally with <link>

  19. mentatxx commented on Aug 20, 2016

    @mentatxx

    Also you can just disable ripple for a while

    <button md-mini-fab [disableRipple]="true">
        <md-icon>add</md-icon>
    </button>
  20. RoxKilly commented on Aug 26, 2016

    @RoxKilly

    @jelbourn If you get the chance, please state briefly why you chose to put the styles in a separate CSS that we have to link to, rather than stay consistent with Angular's isolated scopes approach that keeps styles within the block scope of their component. Is this just temporary?

  21. jelbourn commented on Aug 30, 2016

    @jelbourn
    Contributor

    There are some styles that are used between multiple components (such as ripples), so including them directly in the component css instead of globally would lead to a pretty sizable chunk of duplicate payload.

  22. jelbourn commented on Aug 31, 2016

    @jelbourn
    Contributor

    Closing into #1139

  23. mgpeng commented on Sep 2, 2016

    @mgpeng

    Using rc5 and m2 alpha7-4, md-menu html like this:

         <md-menu>
              <button md-menu-item> Refresh </button>
              <button md-menu-item> Settings </button>
              <button md-menu-item> Help </button>
              <button md-menu-item disabled> Sign Out </button>
          </md-menu>
    

    showed like this after rendering:

      <md-menu _ngcontent-dup-2 role="menu">
           <!--template bindings={}-->
           <!--template bindings={
                "ng-reflect-ng-if":"false"
               }--->
      </md-menu>
    

    include <link rel="stylesheet" href="vendor/@angular2-material/core/style/core.css" /> in index.html nothing changed.

  24. added a commit that references this issue on Sep 9, 2016
  25. KKrisu commented on Oct 2, 2016

    @KKrisu

    Currently (angular 2.0, material 2.0.0-alpha.9) the solution is to include theme in styles.css like:

    /* You can add global styles to this file, and also import other style files */
    @import '../node_modules/@angular/material/core/theming/prebuilt/indigo-pink.css';
    
  26. alexlevy0 commented on Oct 13, 2016

    @alexlevy0

    I'm also with angular 2.0, material 2.0.0-alpha.9 a solution is to create theme doc and link to your project.

    We need to @include md-core();

  27. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    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.

  28. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions