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

[Refactor HTML/CSS] Some selectors in _forms.scss are overly specific #891

Closed
2 tasks done
webinista opened this issue Nov 18, 2015 · 7 comments
Closed
2 tasks done
Assignees
Labels
Type: Enhancement An improvement to existing code
Milestone

Comments

@webinista
Copy link

webinista commented Nov 18, 2015

Description
form button[type=submit] form input[type=submit] and form input[name=password] are more specific selectors than necessary. In order to override them, you have to use a selector that's at least as specific, or use the !important keyword, e.g. form button[type=submit].my-specific-override-class.

Ask
De-nest these selectors, and use [type=submit] and [name=password] instead. They are less specific, which means a developer can override specific declarations with a class name.

To Do

  • Update web-design-standards/assets/_scss/components/_forms.scss and move the rulesets for button[type=submit], input[type=submit], and input[name=password] out of the form block.
  • Change the selectors to [type=submit] and [name=password]
@webinista webinista changed the title form button[type=submit] form input[type=submit] and form input[name=password] are overly specific Some selectors in _forms.scss are overly specific Nov 18, 2015
@maya maya added the frontend label Nov 19, 2015
@maya
Copy link
Contributor

maya commented Nov 21, 2015

@webinista thanks for your feedback! We'd definitely like to review some of our specificity, so this is helpful.

@maya maya added the maybe 1.0 label Feb 6, 2016
@maya maya removed the maybe 1.0 label Mar 15, 2016
@jpyuda jpyuda added this to the Clean, Semantic Code milestone Mar 18, 2016
@juliaelman juliaelman removed the low label May 10, 2016
@rogeruiz rogeruiz added Type: Enhancement An improvement to existing code [Status] Backlog labels May 11, 2016
@msecret
Copy link
Contributor

msecret commented Aug 22, 2016

I think when we have any rules like this:

input[type="text"],
input[type="email"],
...

we should change to this:

[type="text"],
[type="email"],
...

@juliaelman
Copy link
Contributor

Refs #1342

@maya maya changed the title Some selectors in _forms.scss are overly specific [Refactor HTML/CSS] Some selectors in _forms.scss are overly specific Aug 30, 2016
@maya
Copy link
Contributor

maya commented Sep 1, 2016

@msecret I just checked src/stylesheets/components/_forms.scss and there's no element attached like this button[type=submit], input[type=submit], and input[name=password] on the form block, so it looks like this was previously resolved.

What you're referring to is in src/stylesheets/elements/_inputs.scss - would you like to close this issue and re-open one for _inputs.scss?

@msecret
Copy link
Contributor

msecret commented Sep 1, 2016

Yes their in inputs here: https://github.com/18F/web-design-standards/blob/staging/src/stylesheets/elements/_inputs.scss#L21.

Something to try: why do we need the specific type rules if they all include input. What if the rule was just input {?

@msecret
Copy link
Contributor

msecret commented Sep 1, 2016

I wouldn't close and reopen an issue, I'd just reuse this one.

@maya
Copy link
Contributor

maya commented Sep 2, 2016

@msecret Is there any issue with: https://github.com/18F/web-design-standards/blob/staging/src/stylesheets/elements/_inputs.scss#L149

input[type="checkbox"],
input[type="radio"]

Do we want to change it to

[type="checkbox"],
[type="radio"]

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement An improvement to existing code
Projects
None yet
Development

No branches or pull requests

9 participants