-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix: Increase specificity for icon sizes within controls #4001
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
Open
kght6123
wants to merge
4
commits into
jgthms:main
Choose a base branch
from
kght6123:fix-3985
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+16
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resolves jgthms#3985 The .control.has-icons-left .icon selector (0,3,0) was overriding the .icon.is-small selector (0,2,0) due to higher specificity. This change introduces more specific selectors for icon sizes within .control.has-icons-left and .control.has-icons-right contexts, ensuring that .is-small, .is-medium, and .is-large classes applied directly to icons within these controls correctly set their dimensions. For example, .control.has-icons-left .icon.is-small (0,4,0) will now correctly override the base styles for icons in controls.
Resolves jgthms#3985 The .control.has-icons-left .icon selector (0,3,0) was overriding the .icon.is-small selector (0,2,0) due to higher specificity. This change introduces more specific selectors for icon sizes within .control.has-icons-left and .control.has-icons-right contexts, ensuring that .is-small, .is-medium, and .is-large classes applied directly to icons within these controls correctly set their dimensions. For example, .control.has-icons-left .icon.is-small (0,4,0) will now correctly override the base styles for icons in controls.
Resolves jgthms#3985 The .control.has-icons-left .icon selector (0,3,0) was overriding the .icon.is-small selector (0,2,0) due to higher specificity. This change introduces more specific selectors for icon sizes within .control.has-icons-left and .control.has-icons-right contexts, ensuring that .is-small, .is-medium, and .is-large classes applied directly to icons within these controls correctly set their dimensions. For example, .control.has-icons-left .icon.is-small (0,4,0) will now correctly override the base styles for icons in controls.
Resolves jgthms#3985 The .control.has-icons-left .icon selector (0,3,0) was overriding the .icon.is-small selector (0,2,0) due to higher specificity. This prevented direct application of size modifiers like .is-small to icons within controls with icons. This commit introduces more specific selectors for icon sizes (e.g., .control.has-icons-left .icon.is-small) within the .control.has-icons-left and .control.has-icons-right contexts in `sass/form/tools.scss`. These changes ensure that .is-small, .is-medium, and .is-large classes applied directly to icons within these controls correctly set their dimensions, aligning with the Bulma Sass styleguide.
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.
Pull Request Overview
This PR fixes a CSS specificity issue that caused utility size classes on icons within .control.has-icons-left to be overridden by default icon styles.
- Adds nested rules for
.icon.is-small,.icon.is-medium, and.icon.is-largeinside.control.has-icons-left - Ensures direct size utility classes now correctly override the base control icon dimensions
Comments suppressed due to low confidence (2)
sass/form/tools.scss:308
- There are no tests or visual regression checks to verify that these new specificity rules correctly override the default control icon sizes; please add style/unit tests or visual tests for these selectors.
&.#{iv.$class-prefix}is-small {
sass/form/tools.scss:307
- [nitpick] The comment here is generic; consider explaining that these selectors resolve a CSS specificity conflict and why they're scoped under
.control.has-icons-left.
// Sizes
Author
|
@jgthms Is this possible to merge? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #3985
The .control.has-icons-left .icon selector (0,3,0) was overriding the .icon.is-small selector (0,2,0) due to higher specificity.
This change introduces more specific selectors for icon sizes within .control.has-icons-left and .control.has-icons-right contexts, ensuring that .is-small, .is-medium, and .is-large classes applied directly to icons within these controls correctly set their dimensions.
For example, .control.has-icons-left .icon.is-small (0,4,0) will now correctly override the base styles for icons in controls.
This is a bugfix.
Proposed solution
This PR fixes a CSS specificity issue where size utility classes (like
.is-small) applied to an.iconelement within a.control.has-icons-left(or.control.has-icons-right) element were being overridden by the default icon styling for that control.The solution adds more specific CSS rules in
sass/form/tools.scssfor.icon.is-small,.icon.is-medium, and.icon.is-largewhen they are descendants of.control.has-icons-leftor.control.has-icons-right. These new rules ensure that the utility size classes take precedence, allowing developers to directly control the size of icons within input controls as intended.Tradeoffs
No significant tradeoffs are introduced with this solution. The change is highly targeted and increases specificity in a logical way that aligns with the intended use of utility classes. It doesn't add complexity or affect other components.
Testing Done
The Sass code was successfully compiled using the project's build script (
npm run build-bulma) to ensure there were no syntax errors. The logical change in CSS specificity directly addresses the reported bug. Visual confirmation would typically be done by inspecting an HTML page using these classes, but the fix is based on fundamental CSS specificity rules.Changelog updated?
No. (This is a minor bugfix).