Problem/Motivation
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.0.x/core/themes/claro/css/components/container-inline.module.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); }
- Add a comment when there's a value where there is not a variable like
Out of scope
- Changing CSS classes
- Drupal 9 patches
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 |
|---|---|---|---|
| #42 | interdiff-36_42.txt | 1.05 KB | gauravvvv |
| #42 | 3293997-42.patch | 1.21 KB | gauravvvv |
| #41 | Screenshot 2023-03-20 at 8.03.15 PM.png | 27.43 KB | smustgrave |
| #38 | after.png | 154.75 KB | smustgrave |
| #38 | before.png | 149.83 KB | smustgrave |
Comments
Comment #2
sasanikolic commentedComment #3
aditya4478 commentedComment #4
sasanikolic commentedLet's use a common variable for these margins, since they are repeated multiple times.
Comment #5
aditya4478 commentedComment #6
sasanikolic commentedLooking through the coding standards for variable namings here Drupal core CSS coding standards, I believe we should name these variables more strictly to the file that we're using them in.
I suggest something like this, although that might be a bit long: --container-inline-form-items-inline-spacing
Comment #7
Munavijayalakshmi commentedComment #8
Munavijayalakshmi commentedchanged variable namings as per #6.
Comment #9
Munavijayalakshmi commentedtest passed.
Comment #10
aditya4478 commentedIE Block is not there. Ready for Review
Comment #11
aditya4478 commentedIgnore this patch because it has failed tests. I am uploading new patch for version 10
Comment #12
aditya4478 commentedComment #13
aditya4478 commentedComment #14
aditya4478 commentedComment #15
sasanikolic commentedI think we can simplify this even more by using CSS logical properties here by using
margin-block-startandmargin-block-endfor the D10 patch.Comment #16
aditya4478 commentedComment #17
aditya4478 commentedPlease consider #14 & #16 patches
Comment #18
sasanikolic commentedChanges look good to me now.
Comment #19
lauriiiWhy are the source changes different across 9.5.x and 10.0.x? Shouldn't those be the same for both branches?
Comment #20
ckrinaComment #21
ckrinaComment #22
ckrinaComment #23
ckrinaComment #24
ckrinaComment #25
ckrinaComment #26
ckrinaComment #27
ckrinaComment #28
ckrinaComment #29
ckrinaComment #30
ckrinaComment #31
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It either no longer applies to Drupal core, or 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 #32
gauravvvv commentedcontainer-inline.module.cssfile is not updated, I have attached the path with the updated file. Attached interdiff for same.Comment #33
gauravvvv commentedComment #34
gauravvvv commentedIgnore patch in #32.
Comment #35
smustgrave commentedSince the .css file changed think this will require before/after screenshots.
Comment #36
gauravvvv commentedAdded shorthand properties, attached interdiff for same. leaving it as NW, as it still needs after patch screenshot.
Comment #37
pradipmodh13 commented#36 Patch applied successfully.
For ref attached screenshot.
Comment #38
smustgrave commentedTesting by using the cd_core test modules.
Attached before/after screenshots of a fieldset. Can see nothing changed.
Before

After

Comment #40
mherchelThe screenshots in #38 appear to be from Olivero (while this patch only affects Claro).
The CSS looks fine. The only change I would make is to use
2pxinstead of0.125em. Core includes the pxToRem PostCSS plugin that automatically converts it to REM. If we specify px, it'd be easier to read and would negate the need for the comment.Also, where is this being used? The only place I found was in datetime-form.html.twig, and I could find where that was used?
Comment #41
smustgrave commented@mherchel that's my mistake using those claro test modules.
But the template can be found on a node edit form, the author on field.
Here's a screenshot that shows nothing was broken but the PM on the time is cut off. Think if we are updating the css might as well fix that right?
Comment #42
gauravvvv commentedAddressed #40, Made use of px unit on place of em. Attached interdiff for same.
@smustgrave, I can confirm that #41, is happening before patch as well. We can open a follow up issue to address it.
Comment #43
smustgrave commentedPersonally think it would be good to try and fix now but won't hold the ticket up.
Comment #45
akshay kashyap commented@Team, Could we have created variables for the Margin that we are using in the "container-inline.module.css" file?.
Comment #46
akshay kashyap commentedCreated a new patch. Added margin variables in the "container-inline.module.css" file Please review it.
Comment #47
akshay kashyap commentedComment #48
smustgrave commentedFor #46 please include interdiffs and check your patches before uploading.
Remarking RTBC as #42 was previously marked and had a random failure.
Comment #50
nod_One question is that we're supposed to have px in the pcss file but rem in the generated css file. That isn't the case here is this expected?
Comment #51
mherchelOnly values 3px or greater get converted to REM (see https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/scripts/css...). This was added in the initial implementation of PxToRem at https://www.drupal.org/project/drupal/issues/3117698#comment-13857994
Comment #52
nod_Thanks for the confirmation
Committed e2fde99 and pushed to 10.1.x. Thanks!