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

Proposal: Provide public access to a button's ripple #4179

Closed
willshowell opened this issue Apr 20, 2017 · 9 comments · Fixed by #9170
Closed

Proposal: Provide public access to a button's ripple #4179

willshowell opened this issue Apr 20, 2017 · 9 comments · Fixed by #9170
Assignees
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@willshowell
Copy link
Contributor

Bug, feature request, or proposal:

Proposal

What is the proposed behavior?

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.

@devversion
Copy link
Member

Thinking about a good way to expose the ripple instance.. Any ideas already?

@willshowell
Copy link
Contributor Author

Why not just a public @ViewChild(MdRipple) in button.ts?

@devversion
Copy link
Member

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.

@jelbourn
Copy link
Member

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.

@jelbourn jelbourn added discussion P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Apr 20, 2017
@devversion
Copy link
Member

Basically for components like the slide-toggle, radio etc. we provide a ripple config that will be used when calling slide-toggle.ripple.launch().

For buttons it will be a bit more weird because the ripples don't launch from the center.

@willshowell
Copy link
Contributor Author

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.

@devversion
Copy link
Member

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

@willshowell
Copy link
Contributor Author

Big fan of the mixins idea!

@devversion devversion self-assigned this Aug 8, 2017
devversion added a commit to devversion/material2 that referenced this issue Dec 30, 2017
* Exposes the `MatRipple` instance of the button as a public property.

This can be used to show ripple indicators for feature discoveries as seen on the Specs (https://material.io/guidelines/growth-communications/feature-discovery.html#feature-discovery-design-patterns). Quote from the specs "Ripples guide users through subsequent steps".

Closes angular#4179
devversion added a commit to devversion/material2 that referenced this issue Jan 5, 2018
* Adds a new option to the ripples that allows developers to have a better control of the animation (all ripples, or even individual ripples).
* Deprecates the `matRippleSpeedFactor` in favor of the `matRippleAnimation` binding that accepts a `RippleAnimationConfig`. The configuration is more explicit, clean and not confusing as the `speedFactor`.
* To provide a more user-friendly `launch()` method API, the passed ripple config will extend the default ripple config from the `MatRipple` instance (removes unnecessary bloat; requested in angular#4179 (comment))
* Disables ripples for most of the demo buttons in the ripple demo (allows better debugging; when pressing the buttons)
devversion added a commit to devversion/material2 that referenced this issue Jan 5, 2018
* Adds a new option to the ripples that allows developers to have a better control of the animation (all ripples, or even individual ripples).
* Deprecates the `matRippleSpeedFactor` in favor of the `matRippleAnimation` binding that accepts a `RippleAnimationConfig`. The configuration is more explicit, clean and not confusing as the `speedFactor`.
* To provide a more user-friendly `launch()` method API, the passed ripple config will extend the default ripple config from the `MatRipple` instance (removes unnecessary bloat; requested in angular#4179 (comment))
* Disables ripples for most of the demo buttons in the ripple demo (allows better debugging; when pressing the buttons)
devversion added a commit to devversion/material2 that referenced this issue Jan 6, 2018
* Adds a new option to the ripples that allows developers to have a better control of the animation (all ripples, or even individual ripples).
* Deprecates the `matRippleSpeedFactor` in favor of the `matRippleAnimation` binding that accepts a `RippleAnimationConfig`. The configuration is more explicit, clean and not confusing as the `speedFactor`.
* To provide a more user-friendly `launch()` method API, the passed ripple config will extend the default ripple config from the `MatRipple` instance (removes unnecessary bloat; requested in angular#4179 (comment))
* Disables ripples for most of the demo buttons in the ripple demo (allows better debugging; when pressing the buttons)
jelbourn pushed a commit that referenced this issue Jan 21, 2018
* Exposes the `MatRipple` instance of the button as a public property.

This can be used to show ripple indicators for feature discoveries as seen on the Specs (https://material.io/guidelines/growth-communications/feature-discovery.html#feature-discovery-design-patterns). Quote from the specs "Ripples guide users through subsequent steps".

Closes #4179
devversion added a commit to devversion/material2 that referenced this issue Jan 23, 2018
* Exposes the `MatRipple` instance of the button as a public property.

This can be used to show ripple indicators for feature discoveries as seen on the Specs (https://material.io/guidelines/growth-communications/feature-discovery.html#feature-discovery-design-patterns). Quote from the specs "Ripples guide users through subsequent steps".

Closes angular#4179
devversion added a commit to devversion/material2 that referenced this issue Jan 23, 2018
* Adds a new option to the ripples that allows developers to have a better control of the animation (all ripples, or even individual ripples).
* Deprecates the `matRippleSpeedFactor` in favor of the `matRippleAnimation` binding that accepts a `RippleAnimationConfig`. The configuration is more explicit, clean and not confusing as the `speedFactor`.
* To provide a more user-friendly `launch()` method API, the passed ripple config will extend the default ripple config from the `MatRipple` instance (removes unnecessary bloat; requested in angular#4179 (comment))
* Disables ripples for most of the demo buttons in the ripple demo (allows better debugging; when pressing the buttons)
jelbourn pushed a commit that referenced this issue Jan 24, 2018
Exposes the `MatRipple` instance of the button as a public property.

This can be used to show ripple indicators for feature discoveries as seen on the Specs (https://material.io/guidelines/growth-communications/feature-discovery.html#feature-discovery-design-patterns). Quote from the specs "Ripples guide users through subsequent steps".

Closes #4179
devversion added a commit to devversion/material2 that referenced this issue Jan 24, 2018
* Adds a new option to the ripples that allows developers to have a better control of the animation (all ripples, or even individual ripples).
* Deprecates the `matRippleSpeedFactor` in favor of the `matRippleAnimation` binding that accepts a `RippleAnimationConfig`. The configuration is more explicit, clean and not confusing as the `speedFactor`.
* To provide a more user-friendly `launch()` method API, the passed ripple config will extend the default ripple config from the `MatRipple` instance (removes unnecessary bloat; requested in angular#4179 (comment))
* Disables ripples for most of the demo buttons in the ripple demo (allows better debugging; when pressing the buttons)
jelbourn pushed a commit that referenced this issue Jan 24, 2018
* Adds a new option to the ripples that allows developers to have a better control of the animation (all ripples, or even individual ripples).
* Deprecates the `matRippleSpeedFactor` in favor of the `matRippleAnimation` binding that accepts a `RippleAnimationConfig`. The configuration is more explicit, clean and not confusing as the `speedFactor`.
* To provide a more user-friendly `launch()` method API, the passed ripple config will extend the default ripple config from the `MatRipple` instance (removes unnecessary bloat; requested in #4179 (comment))
* Disables ripples for most of the demo buttons in the ripple demo (allows better debugging; when pressing the buttons)
@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 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants