You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal: Provide public access to a button's ripple #4179
Public access to the MdRipple within a button, nav-list-item, etc
What is the use-case or motivation?
I'd like to programmatically trigger a button's ripple to call attention to it. Under feature discovery, there is discussion of using ripples to guide users through flows: "Ripples guide users through subsequent steps".
Currently, there is no good way (if any?) to access the button's ripple. I suppose I could create a new rippled component and position and mask it correctly, but that seems needlessly complex.
Hm yeah. We might be able to just make that public. For most of the components like md-slide-toggle, md-checkbox and md-radio we already have a reference to the MdRipple directive.
Need to discuss this first with @jelbourn. Not sure if we should expose the underlying ripple instance.
The launch method on MdRipple doesn't exactly have an API that would make it easy to say something like button.ripple.launch(). If we were going to expose the instance, I'd want to have a simpler user-facing API.
I think I see the difficulty. With a normal button, if you just used launch() it would render from the top left of the viewport and only barely show up within the button's bounds.
It would seem ideal to be able to pass an override config through launch() that would merge with the preexisting config:
this.button.ripple.launch(0,0,{centered: true});
Overall, I agree with @jelbourn that the api could/should be simplified. It isn't exactly clear how pageX, pageY, and centered all interact, and it doesn't seem like there's a good way to trigger a ripple from, say, the bottom left corner of a component.
@willshowell Exactly, the ripple would render from the top-left.
And regarding positioning, I personally think that such positioning stuff shouldn't be part of the ripple service. The service was designed to be very low-level since it is mostly used internal.
What I think would be a better way, is like a TypeScript mixin (e.g #3944) that will provide a custom launchRipple method on the button.
This mixin could be responsible for more API-friendly ways of launching ripples on a component.
Although I still don't think that we should provide APIs for bottom-left, bottom-right etc. positions.
Activity
devversion commentedon Apr 20, 2017
Thinking about a good way to expose the ripple instance.. Any ideas already?
willshowell commentedon Apr 20, 2017
Why not just a public
@ViewChild(MdRipple)inbutton.ts?devversion commentedon Apr 20, 2017
Hm yeah. We might be able to just make that public. For most of the components like
md-slide-toggle,md-checkboxandmd-radiowe already have a reference to theMdRippledirective.Need to discuss this first with @jelbourn. Not sure if we should expose the underlying ripple instance.
jelbourn commentedon Apr 20, 2017
The
launchmethod onMdRippledoesn't exactly have an API that would make it easy to say something likebutton.ripple.launch(). If we were going to expose the instance, I'd want to have a simpler user-facing API.devversion commentedon Apr 20, 2017
Basically for components like the
slide-toggle,radioetc. we provide a ripple config that will be used when callingslide-toggle.ripple.launch().For buttons it will be a bit more weird because the ripples don't launch from the
center.willshowell commentedon Apr 20, 2017
I think I see the difficulty. With a normal button, if you just used
launch()it would render from the top left of the viewport and only barely show up within the button's bounds.It would seem ideal to be able to pass an override config through
launch()that would merge with the preexisting config:Overall, I agree with @jelbourn that the api could/should be simplified. It isn't exactly clear how
pageX,pageY, andcenteredall interact, and it doesn't seem like there's a good way to trigger a ripple from, say, the bottom left corner of a component.devversion commentedon Apr 20, 2017
@willshowell Exactly, the ripple would render from the top-left.
And regarding positioning, I personally think that such positioning stuff shouldn't be part of the ripple service. The service was designed to be very low-level since it is mostly used internal.
What I think would be a better way, is like a TypeScript mixin (e.g #3944) that will provide a custom
launchRipplemethod on the button.This mixin could be responsible for more API-friendly ways of launching ripples on a component.
Although I still don't think that we should provide APIs for
bottom-left,bottom-rightetc. positions.willshowell commentedon Apr 20, 2017
Big fan of the mixins idea!
feat(button): expose ripple instance
feat(ripple): support animation duration overwrites
feat(ripple): support animation duration overwrites
feat(ripple): support animation duration overwrites
feat(button): expose ripple instance
feat(button): expose ripple instance
feat(ripple): support animation duration overwrites
feat(button): expose ripple instance (#9170)
feat(ripple): support animation duration overwrites
feat(ripple): support animation duration overwrites (#9253)
angular-automatic-lock-bot commentedon Sep 8, 2019
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.