Problem/Motivation
This is part of the CSS modernization initiative. This is intended to be a straightforward second issue.
The first issue was regarding the button stylesheet.
Steps to reproduce
The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/themes/claro/css/components/button.pcss.css needs to be refactored to make use of modern CSS and Drupal core's PostCSS tooling.
Proposed resolution
Use CSS Logical Properties where appropriate
Use CSS nesting where appropriate
Remaining tasks
User interface changes
None. There should be no visual differences.
Testing HTML
<h2>Regular</h2>
<button class="button">Lorem, ipsum dolor.</button><br>
<a href="#" class="button">Lorem, ipsum dolor.</a><br>
<input type="submit" class="button" value="Lorem ipsum dolor"><br>
<h2>Small</h2>
<button class="button button--small">Lorem, ipsum dolor.</button><br>
<a href="#" class="button button--small">Lorem, ipsum dolor.</a><br>
<input type="submit" class="button button--small" value="Lorem ipsum dolor"><br>
<h2>Extra Small</h2>
<button class="button button--extrasmall">Lorem, ipsum dolor.</button><br>
<a href="#" class="button button--extrasmall">Lorem, ipsum dolor.</a><br>
<input type="submit" class="button button--extrasmall" value="Lorem ipsum dolor"><br>
<h2>Action</h2>
<button class="button button--action">Lorem, ipsum dolor.</button><br>
<a href="#" class="button button--action">Lorem, ipsum dolor.</a><br>
<input type="submit" class="button button--action" value="Lorem ipsum dolor"><br>
<h2>primary</h2>
<button class="button button--primary">Lorem, ipsum dolor.</button><br>
<a href="#" class="button button--primary">Lorem, ipsum dolor.</a><br>
<input type="submit" class="button button--primary" value="Lorem, ipsum dolor."><br>
<h2>danger</h2>
<button class="button button--danger">Lorem, ipsum dolor.</button><br>
<a href="#" class="button button--danger">Lorem, ipsum dolor.</a><br>
<input type="submit" class="button button--danger" value="Lorem, ipsum dolor."><br>
<h2>Disabled</h2>
<button disabled class="button">Lorem, ipsum dolor.</button><br>
<button class="button is-disabled">Lorem, ipsum dolor.</button><br>
<a href="#" class="button is-disabled">Lorem, ipsum dolor.</a><br>
<input type="submit" disabled class="button" value="Lorem ipsum dolor"><br>
<input type="submit" class="button is-disabled" value="Lorem ipsum dolor"><br>
<h2>Link</h2>
<button class="link">Lorem, ipsum dolor.</button><br>
<input type="submit" class="link" value="Lorem ipsum dolor"><br>
Comments
Comment #2
aditya4478 commentedIgore this patch
Comment #3
aditya4478 commentedNo block for IE in this file. It's good to go for review.
Comment #4
aditya4478 commentedTest Fails :(
I will attach new patch
Comment #5
aditya4478 commentedComment #6
mherchelSet to Needs Work because patch doesn't apply.
Comment #7
aditya4478 commentedComment #8
ckrinaComment #9
ckrinaComment #10
sandeepsingh199 commentedrerolling patch #7 for D10.1.x
Comment #11
mherchelThis patch needs a lot of work. We don't need all of those CSS variables re-rolled, in addition the formatting is way off.
Lets start from a blank slate instead of working off the current patch. We
Comment #12
shivam-kumar commentedWorked on patch #10 Errors, removed unwanted all CSS variables,(as mentioned in comment #11) fixed as per coding standard.
Attached the interdiff file.
Comment #13
mherchelThanks for the work, but this still needs work. We don't need to import the variables as they're natively supported by the browser. In addition, we need to use CSS logical properties.
Comment #14
Ratan Priya commentedFixed CCF for #12.
Please review.
Comment #15
mherchelPlease see my previous comment. This needs work (not a reroll)
Comment #16
gauravvvv commentedI have addressed the issues from #11, #13.
1. Removed all RTL changes: Used
margin-inline-start & margin-inline-endinstead ofmargin-left, margin-right2. Removed LTR comments.
3. Improved nesting
4. Removed importing variables.
Please review
Comment #17
gauravvvv commentedsingle quote fix.
Comment #18
smustgrave commentedReviewing #17
All lines appear to be nested correctly
Colors are replaced by variables
Looks good to me.
Comment #19
bnjmnmmargin-block: var(--space-m);margin-inline: 0 var(--space-s);There's no longer an RTL equivalent so this /* LTR */ should no be there
use margin-block shorthand
use margin-inline shorthand
margin inline shorthand
use padding-inline shorthand
these two lines can be
These two lines can be
margin-inline: 0 var(--space-s);Comment #20
gauravvvv commentedAddressed all from #19. please review
Comment #22
gauravvvv commentedUnrelated failure, restoring status.
Comment #23
smustgrave commentedPoints appear to have been addressed
Comment #24
lauriiiThe patch looks pretty good. Someone will still need to test this thoroughly.
We have used https://github.com/zolhorvath/cd_tools in the past but I don't think it's Drupal 10 compatible 😐
Comment #25
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #26
lauriiiComment #27
smustgrave commentedOh neat. Cloned the module and changed for D10 in core_version_requirements
Comment #28
nod_Need to use logical props
we need this rule
Otherwise danger links that are active have a black text color instead of white which makes them hard to read and not very pretty.
Comment #29
gauravvvv commentedAddressed feedback from #28. please review
Comment #30
nod_can we keep the rules as they were before? last patch changes the specificity of the background rule when we only want to override the color property.
Comment #31
mherchelI don't see where the last patch changes the specificity, but I do see some unneeded specificity in the patch. In addition,
!importantwhere the comments say that its for FF in high contrast mode. I can't see why. I'm going to test this out and remove if possible..I'm going to put a bit of work in now, and see how far I can get.
Comment #32
mherchelAdding testing HTML to IS
Comment #33
mherchelComment #34
mherchelUpdated patch attached.
Comment #35
mherchelA couple notes on the patch above:
!importantrule for Firefox in forced-colors mode is no longer necessary. Animated GIF is attached below.:rootare used in the Dropbutton component, so I couldn't move them into here without affecting that. We can do that at a later time.Firefox in high contrast (also showing focus styles):

Comment #36
smustgrave commented#34 looks good to me.
Comment #39
stanzin commentedrerolling #34 to make the test pass.
Comment #40
aditya4478 commentedComment #41
gauravvvv commentedPatch #34, does not apply anymore. I have attached the re-rolled patch.
Comment #42
zeeshan_khan commented#41 - Works for me
patch applied successfully
Thanks @Gauravvvv for the hard work!
Comment #44
lauriiiCommitted e5b998e and pushed to 11.x. Thanks!
Comment #46
quietone commentedThis is a minor only change, removing tag for the followup.