This is a child of #3324398: [META] Update Claro CSS with new coding standards and part of #3254529: [PLAN] Drupal CSS Modernization Initiative.
Steps to reproduce
The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/themes/claro/css/base/elements.pcss.css needs to be refactored to make use of modern CSS and Drupal core's PostCSS tooling.
@todo: Add clear testing instructions to test this manually on the UI.
Proposed resolution
Use CSS Logical Properties where appropriate.
Use CSS nesting where appropriate.
Use existing variables (variables.pcss.css) where appropriate. Follow the proposed Drupal CSS coding standards to name the variables.
Add a comment when there's a value where there is not a variable like font-size: 1.23rem; /* @todo One off value. */
When possible, set variables at the root of the component and then map them to global theme variables:
.entity-meta {
--entity-meta-title-font-size: var(--font-size-h5);
... more style
}
.entity-meta__title {
font-size: var(--entity-meta-title-font-size);
}Out of scope
User interface changes
None. There should be no visual differences.
Please post before/after screenshots and make sure they look the same.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screenshot 2023-04-20 at 7.12.51 PM.png | 184.97 KB | santosh_verma |
| #5 | before-3332729-32.png | 121.88 KB | santosh_verma |
| #5 | Screenshot 2023-04-20 at 7.10.03 PM.png | 117.41 KB | santosh_verma |
| #2 | Screenshot 2023-04-20 at 9.36.46 AM.png | 205.85 KB | gauravvvv |
Issue fork drupal-3355248
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3355248-refactor-claros-elements
changes, plain diff MR !3855
Comments
Comment #2
gauravvvv commentedSome RTL styling of elements.pcss.css file is overriding the normal CSS.
Additional spacing is added on RTL direction, because we're not using logical properties in
elements.pcss.cssfileBefore patch
Comment #4
gauravvvv commentedComment #5
santosh_verma commentedI have tested after applying the the 1st patch (3332729-32.patch)

https://www.drupal.org/project/drupal/issues/3332729
the issue appears
before patch
after patch

issue resolved with the current MR

Comment #6
santosh_verma commentedComment #7
bnjmnmLooks good overall, but found one more nesting opportunity in the MR. See the comment there.
Comment #9
rpayanmPlease review.
Comment #10
smustgrave commentedAdditional nesting seems good.
Comment #11
santosh_verma commentedReviewed the comment #9 MR,Nothing changed into css file after nesting, it looks good to me
RTBC +1
Sorry for the duplicate comment @smustgrave, I was working on it posted the comment without refreshing the page.
Comment #15
lauriiiCommitted 539ad62 and pushed to 11.x. Thanks!