googlearchive / paper-radio-group

A group of radio buttons
6 stars 1 forks source link

paper-radio-group and paper-radio-button should be more aligned #9

Open kenmoore opened 10 years ago

kenmoore commented 10 years ago

As documented, the 'selected' attribute of paper-radio-button keys off of the 'name' attribute of the child paper-radio-buttons. This design has issues:

But I see the argument for inconsistency: in a paper-dropdown-menu the items are not likely to be extremely long, whereas paper-radio-button items may be full sentences (or more), which would be cumbersome for setting the selection.

Looking at the elements side-by-side, I find it unsettling how structurally similar, but syntactically different they are:

<paper-dropdown-menu selected="Financier" valueattr="label">
    <paper-item label="Croissant"></paper-item>
    <paper-item label="Donut"></paper-item>
    <paper-item label="Financier"></paper-item>
    <paper-item label="Madeleine"></paper-item>
</paper-dropdown-menu>

<paper-radio-group selected="small">
  <paper-radio-button name="small" label="Small is good for baby bear”></paper-radio-button>
  <paper-radio-button name="medium" label="Medium is just right”></paper-radio-button>
  <paper-radio-button name="large" label="Large is good for papa bear”></paper-radio-button>
</paper-radio-group>

Here's how they might look:

<paper-dropdown-menu selected=“financier">
    <paper-item value=“croissant">Croissant</paper-item>
    <paper-item value=“donut">Donut</paper-item>
    <paper-item value=“financier">Financier</paper-item>
    <paper-item value=“madeleine">Madeline</paper-item>
</paper-dropdown-menu>

<paper-radio-group selected="small">
  <paper-radio-button value="small”>Small is good for baby bear</paper-radio-button>
  <paper-radio-button value="medium”>Medium is just right</paper-radio-button>
  <paper-radio-button value="large”>Large is good for papa bear</paper-radio-button>
</paper-radio-group>

In addition to providing high consistency, this proposal:

Thoughts?

ssorallen commented 9 years ago

I agree this feels inconsistent. Since the paper-radio-button is meant to mimic <input type="radio"> behavior, I would stay away from letting paper-radio-button have children. I would change the second half of your proposal to the following:

<paper-radio-group selected="small">
  <paper-radio-button value="small” label="Small is good for baby bear">
  <paper-radio-button value="medium” label="Medium is just right">
  <paper-radio-button value="large” label="Large is good for papa bear">
</paper-radio-group>