-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix radius on input-group-label and input-group-button #11104
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three things to keep in mind when adding selectors:
- Selectors specificity must be the lowest possbile
- Parents should not apply properties automatically on their children
- Duplicated properties
scss/forms/_input-group.scss
Outdated
border-radius: if($global-text-direction == rtl, 0 $input-radius $input-radius 0, $input-radius 0 0 $input-radius); | ||
} | ||
|
||
&.input-group-button > * { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Selectors can be merged here are the code in the same. So:
&:not(.input-group-button), &.input-group-button > * {
...
}
(don't do that, see the comment above).
Otherwise we're just duplicating code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've DRY'd this. :)
scss/forms/_input-group.scss
Outdated
@@ -34,11 +34,21 @@ $input-prefix-padding: 1rem !default; | |||
} | |||
|
|||
> :first-child { | |||
border-radius: if($global-text-direction == rtl, 0 $input-radius $input-radius 0, $input-radius 0 0 $input-radius); | |||
&:not(.input-group-button){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Foundation provide a SASS library, not only CSS components.
- We can't expect Input group button to be implemented as
.input-group-button
(user should be able to create custom components with input group mixins) - Why only targetting Input group button ?
So I would rather go for:
&, & > * { ... }
To be honnest, the > *
is ugly and should be removed. But we'll keep it for backward compatibility. Adding a comment here like "don't do this" could be useful so it does not became an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since .input-group-button
is hardcoded later in the foundation-form-prepostfix
mixin, can't we expect it to be implemented as .input-group-button
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah f**. I did not realized that Input Group was not component-oriented at all !
Well, its still a problem: Why only targetting Input group button ?
This is generally a bad idea to make our CSS component having particular effects on each-others as the user should be able to use them with custom CSS alongside its own components. Input Group should have the same behavior no matter what is the class of the button we put it. This is a quiet easy way to make someone loose 1 hour: "Why when I put my own button there it is not rounded anymore."
@ncoden I say we live with this not being component-oriented, and make sure not to repeat this mistake in v7. Are there any remaining changes you require? |
|
Because the docs explicitly state to place buttons inside the |
We could probably get rid of the |
We should assume as little as possible to HTML structure inside our components. People should be able to freely use the classes of components/elements we provide without limited by self-references and dependencies (like
Got it. So I think we can drop &, &.input-group-button > * { ... } As |
@andycochran What do you think ? |
@andycochran Hey 👋. Will you have some time work on this ? I'd like your opinon on #11104 (comment) |
We should assume as little as possible to HTML structure inside our components. People should be able to freely use the classes of components/elements we provide without limited by self-references and dependencies. This commit simplify the selector used to apply border-radius on Input Group childreens to make all childreens affected, with a single exception for `.input-group-button` where sub-childreens are affected too.
I applied the requested changes
Looks ready for stable v6.5.0 |
Oh, node-sass failing on Node.js 10? |
This PR closes #8833 by explicitly setting styles for
.input-group-button
within.input-group
so that it and.input-group-label
have the expected border radius.