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

Weird ripple effect #972

Closed
BenevidesLecontes opened this issue Aug 9, 2016 · 36 comments
Closed

Weird ripple effect #972

BenevidesLecontes opened this issue Aug 9, 2016 · 36 comments

Comments

@BenevidesLecontes
Copy link

BenevidesLecontes commented Aug 9, 2016

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], {})
    ]
@jelbourn
Copy link
Member

jelbourn commented Aug 9, 2016

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

@BenevidesLecontes
Copy link
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.

@jelbourn
Copy link
Member

jelbourn commented Aug 9, 2016

cc @dozingcat

@dozingcat
Copy link
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.

@BenevidesLecontes
Copy link
Author

BenevidesLecontes commented Aug 9, 2016

@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
Copy link
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

@dozingcat
Copy link
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.

@BenevidesLecontes
Copy link
Author

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

@sunshineo
Copy link

sunshineo commented Aug 10, 2016

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

@fernandogomesdf
Copy link

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

@colinfang
Copy link

colinfang commented Aug 10, 2016

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

@colinfang
Copy link

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.

@ivoviz
Copy link

ivoviz commented Aug 10, 2016

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

@BenevidesLecontes
Copy link
Author

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

@dozingcat
Copy link
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?

@ivoviz
Copy link

ivoviz commented Aug 10, 2016

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

@BenevidesLecontes
Copy link
Author

@ivoviz adding core.css solved the scroll problem?

@ivoviz
Copy link

ivoviz commented Aug 10, 2016

@BenevidesLecontes Yes it did for me.

@BenevidesLecontes
Copy link
Author

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

@fernandogomesdf
Copy link

@colinfang thank you, it was my mistake

@Mufasa
Copy link

Mufasa commented Aug 12, 2016

Hi,

I am experiencing the same issue in my angular 2 app and was wondering how I can get hold of the core.css file that @ivoviz claims will solve this issue?

Alternatively, can anyone give me an ETA as to when this is officially likely to get fixed?

Thanks in advance

@jelbourn
Copy link
Member

It is in node_modules/@angular2-material/core

@sspilleman
Copy link

styleUrls: [
    '../../node_modules/@angular2-material/core/style/core.css',
    '../../node_modules/@angular2-material/core/overlay/overlay.css',
    '../../public/styles/main.scss'
]

@Mufasa
Copy link

Mufasa commented Aug 14, 2016

Thanks both - that fixed my issue.

BTW: I had also reported this at Google Groups - angular-material2 and have mentioned these work-arounds there as well.

@xhite
Copy link

xhite commented Aug 18, 2016

@jelbourn @sspilleman it doesn't work for me on alpha7-4. The issue persists even after loading those css files

@colinfang
Copy link

@xhite Maybe because of #1004?

@jelbourn
Copy link
Member

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

@xhite
Copy link

xhite commented Aug 18, 2016

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

bgauvey added a commit to bgauvey/service-tracker that referenced this issue Aug 20, 2016
@mentatxx
Copy link

Also you can just disable ripple for a while

<button md-mini-fab [disableRipple]="true">
    <md-icon>add</md-icon>
</button>

@RoxKilly
Copy link

RoxKilly commented Aug 26, 2016

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

@jelbourn
Copy link
Member

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.

maltehol pushed a commit to HiP-App/HiP-CmsAngularApp that referenced this issue Aug 30, 2016
added workaround for weired ripple effect (angular/components#972)
@jelbourn
Copy link
Member

Closing into #1139

@mgpeng
Copy link

mgpeng commented Sep 2, 2016

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.

emoralesb05 added a commit to Teradata/covalent that referenced this issue Sep 9, 2016
#### Breaking Changes
- Upgraded to `RC6`
- Upgrade material to `alpha.8-1`
- Added `hammerjs` dependency for material.
- Removed bootstrap and implemented everything with `NgModule` decorator.
- Changed `TdLoadingDirective`'s creation to be sync so it can be accessed in the `ngAfterViewInit` hook.
- Removed es6-shim and reflect-metadata and replaced with core-js library. (need to update angular-CLI, index.html and karma.conf.js)
- removed `md-content` and added `.md-content`
- Replaced Type with Type<any>
- Need to add angular2-material `core.css` and `overlay.css` as a workaround for ripple and menu into index.html angular/components#972

#### Features
- Added tooltip, slider, button-toggle and menu from angular-material.

#### Bug Fixes
- Changed code in animations since the angular classes used are no longer public and changed duration to 150ms so it doesnt look like its frozen in IE/Firefox (they dont support animations).
- Fixed file-upload select/drop events for Firefox and IE.

#### Internal
- Restructured imports in `docs` to remove the majority of the index.ts files and less explicit declarations in `system-config.ts`.
- Unit test `karma-test-shim` changes to set up test environment.
- Removed all unit tests (gonna start from scratch with each one).
- Unit tests changes to use `TestBed` and remove imports `describe`/`it`/`beforeEach` since they are taken as global.
- Removed depricated code all over the platform.
@KKrisu
Copy link

KKrisu commented Oct 2, 2016

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';

@alexlevy0
Copy link

alexlevy0 commented Oct 13, 2016

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();

@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 Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests