mobify / vellum

Default project styles for a mobile-first AdaptiveJS build.
MIT License
5 stars 0 forks source link

Forms checkbox radio update #74

Closed nastiatikk closed 9 years ago

nastiatikk commented 9 years ago

Status: Ready for Review Owner: Anastasia Reviewers: @ry5n @avelinet @mlworks @cole-sanderson @kpeatt @jeffkamo

Changes

ry5n commented 9 years ago

@nastiatikk Can you expand on the issue summary? I can’t tell why these changes are being made – why does the dust sample markup not match what’s in the tests? How do we know which is correct?

Also, the re-written index.html in test/ uses tabs instead of spaces and seems to have indent issues in general.

nastiatikk commented 9 years ago

@ry5n We have discrepancy between _forms.dust, _forms.scss and index.html files.

If you check /test/index.html mark up you will see this:

<label>
    <input type="radio" class="radio" name="radio_button" value="radio_1"> 
    Radio 1
</label>

If you check /templates/_forms.dust you will see this:

<div>
    <input id="radio-button" type="radio" />
    <label for="radio-button">A radio button and its label!</label>
</div>

forms.dust has markup that we usually use in our projects, but Vellum scss didn't match that markup. I made them all match and also made a tweak that correctly drops label to the new line if it's too long.

PS: index.html had 2 spaces tabs, I changed it to 4 spaces but forgot to switch from tabs.

nastiatikk commented 9 years ago

From the files history index.html wasn't updated since it was created on Mar 31, 2014 whilst forms.dust was updated on Nov 19, 2014

nastiatikk commented 9 years ago

Forgot to mention that with forms.dust file markup we can style disabled states of radio and checkbox, what we can't do with index.html markup

jeffkamo commented 9 years ago

Perhaps the scope of this PR should focus on cleaning up the markup. The changes to the styles is something I'm not sure we want would want to do here.

ry5n commented 9 years ago

Yes, let’s focus this PR on moving all example markup into one place and deciding how it should look.

nastiatikk commented 9 years ago

So, we need to decide then what is our default markup:

№1
<label>
    <input type="radio" class="radio" name="radio_button" value="radio_1"> 
    Radio 1
</label>

OR

№2
<div>
    <input id="radio-button" type="radio" />
    <label for="radio-button">A radio button and its label!</label>
</div>

And anyway change the styles because №1 is not that we use in our projects and №2 doesn't match our Vellum styles: screenshot 2015-03-25 16 26 11

nastiatikk commented 9 years ago
<label>
    <input type="radio" class="radio" name="radio_button" value="radio_1"> 
    Radio 1
</label>

If existing styles ^ are gonna be our default styles (even if they're not used in the projects) then I think we can close this PR, and I will create select-box component where we could apply this markup and styles.

jeffkamo commented 9 years ago

I prefer option 2. That's also how we've it works in our field component.

ry5n commented 9 years ago

Same: no. 2.

nastiatikk commented 9 years ago

Well, in this case I need to change styles to match new markup and somehow avoid using float: left

jeffkamo commented 9 years ago

Hmm, I'm not sure you should worry about the radio/checkbox + label layout in vellum... I still think that can be the responsibilitity of c-field. Thoughts @ry5n?

nastiatikk commented 9 years ago

@jeffkamo If №2 is chosen to be Vellum markup, we will have this result without worrying about radio/checkbox + label:

screenshot 2015-03-25 16 26 11

jeffkamo commented 9 years ago

why not leave them as inline-block?

nastiatikk commented 9 years ago

Because with inline-block long labels will drop down

screenshot 2015-03-26 15 23 21

ry5n commented 9 years ago

My gut says this is a layout concern that probably doesn’t belong in Vellum. Checkboxes and radios are inline-block by default; we should probably leave them that way. I agree with @jeffkamo that a component should be responsible for more complex formatting of these elements together.

nastiatikk commented 9 years ago

It is layout concern, but this concern will not let us use default markup never. So what is the point of having this markup then or what is the point of having it broken?

jeffkamo commented 9 years ago

I don't really forsee us ever using these elements (checkbox/radio input + label) in this fashion in any projects going forward. So I don't really feel like it's an issue.

If it helps, you can think of Vellum styles as just the visual look of these things, rather than defining how two or more elements interact.

kpeatt commented 9 years ago

Definitely let's make a component that makes this better but it shouldn't be on Vellum to do it.

nastiatikk commented 9 years ago

Yes, it makes sense.

I've changed it and it can be reviewed again!

Changes:

ry5n commented 9 years ago

@nastiatikk Cool. Fixing the HTML in a separate PR is probably the right call. So then I think the only remaining issues:

I haven’t had a chance to look at the rendered output since the last change but I’ll do that as soon as I can.

jeffkamo commented 9 years ago

Looking good. It appears you some merge conflicts to deal with, but probably when you have that cleaned up this will be good to merge. :+1: