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

Radios should activate ripple when their corresponding label is pressed #9

Closed
traviskaufman opened this issue Dec 5, 2016 · 4 comments

Comments

@traviskaufman
Copy link
Contributor

What MDL Version are you using? (please be specific, e.g. major.minor.patch)

v2 @ master

What browser(s) is this bug affecting (including version)?

all

What OS (and version) are you using?

OS X El Capitan

What are the steps to reproduce the bug? Can you create a plunker/codepen/jsfiddle which reproduces it?

  1. Type npm run dev and navigate to http://localhost:8080/radio.html
  2. Click on a label for a radio

What is the expected behavior?

The ink ripple should activate

What is the actual behavior?

Only the focus ripple activates

Any other information you believe would be useful?

This is due to the fact that isSurfaceActive is always set to false in the radio's ripple adapter. Instead, we need to set it conditionally based on whether or not the label is being interacted with.

Copied from google/material-design-lite#4830

@traviskaufman
Copy link
Contributor Author

Since input control components don't know about their labels implicitly, this one maybe tricky to implement. Let's discuss solutions here before deciding on a concrete implementation.

@sgomes
Copy link
Contributor

sgomes commented Dec 29, 2016

Proposal 1: fire ripple on focus, if not currently rippling.

Add a focus event listener to the native radio control, trigger ripple when received (if not currently rippling).

The downside is that a ripple would also be triggered when tabbing to the element, which I'm not sure is desirable. Distinguishing between a tab focus and a label click focus would require either a global event listener, or a DOM search + event listener addition to every label that may be associated with the control (both undesirable).

Requirements: A mechanism for firing a ripple animation on demand in MDCRipple. A mechanism for determining if a ripple is currently in progress in MDCRadio.

Proposal 2: implement ripple-triggering in mdc-form-field.

Expose a fireRipple() method in the radio component. In mdc-form-field init, add a click event listener to the label (if present), and have it trigger fireRipple() in the control (if present).

The major downside is that mdc-form-field would become a JS component, when it's currently a CSS-only component. One other downside is that a label would only trigger a ripple effect on a radio if inside of an mdc-form-field block.

Requirements: A mechanism for firing a ripple animation on demand in MDCRipple.

@traviskaufman @amsheehan WDYT?

@amsheehan
Copy link
Contributor

I wonder if the caveat for Proposal 2 is such a big deal since we may have to fix autofill textfields with JavaScript anyway (#137)

Seems like triggering a ripple from tabbing (as in proposal 1), unless we implement that on all form elements, might be distracting. That could also be a question for other members of Material Design as well.

@traviskaufman
Copy link
Contributor Author

Proposal 2 seems best, however it seems like a lot of work. Let's confirm with design that this UX is best moving forward, and if so, we'll implement.

sgomes pushed a commit that referenced this issue Feb 14, 2017
This PR creates MDCFormField, which manages the runtime relationship
between an input element and its label, enabling label events to
trigger input ripples. Implements #9.
sgomes pushed a commit that referenced this issue Feb 14, 2017
This PR creates MDCFormField, which manages the runtime relationship
between an input element and its label, enabling label events to
trigger input ripples. Implements #9.
sgomes pushed a commit that referenced this issue Feb 14, 2017
This PR creates MDCFormField, which manages the runtime relationship
between an input element and its label, enabling label events to
trigger input ripples. Implements #9.
sgomes pushed a commit that referenced this issue Feb 17, 2017
This PR creates MDCFormField, which manages the runtime relationship
between an input element and its label, enabling label events to
trigger input ripples. Implements #9.
sgomes pushed a commit that referenced this issue Feb 17, 2017
This PR creates MDCFormField, which manages the runtime relationship
between an input element and its label, enabling label events to
trigger input ripples. Implements #9.
cristobalchao pushed a commit that referenced this issue Feb 24, 2017
This PR creates MDCFormField, which manages the runtime relationship
between an input element and its label, enabling label events to
trigger input ripples. Implements #9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants