Problem/Motivation
This is part of the CSS modernization initiative.
The first issue was regarding the file stylesheet.
Steps to reproduce
The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/themes/claro/css/components/file.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
We need two patches. One for Drupal 9.5.x and one for Drupal 10.0.x
We need a followup issue to refactor this component in Drupal 10.0.x to make use of component-level CSS custom properties.
User interface changes
None. There should be no visual differences.
Comment | File | Size | Author |
---|---|---|---|
#62 | Screenshot 2023-04-18 at 4.09.48 PM.png | 144.77 KB | Santosh_Verma |
#52 | interdiff-40_52.txt | 1.97 KB | Gauravvvv |
#52 | 3293398-52.patch | 1.92 KB | Gauravvvv |
#51 | trial.patch | 21.77 KB | Stanzin |
#40 | 3293398-40.patch | 2.23 KB | Gauravvvv |
|
Issue fork drupal-3293398
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:
Comments
Comment #2
Aditya4478 CreditAttribution: Aditya4478 commentedPatch for Drupal 10.0.x
Comment #3
Aditya4478 CreditAttribution: Aditya4478 commentedComment #4
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedComment #5
Aditya4478 CreditAttribution: Aditya4478 commentedComment #6
Aditya4478 CreditAttribution: Aditya4478 commentedComment #7
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedI don't think this is correct. + is a css selector for direct siblings, while dir="rtl" is the selector for right-to-left languages. This should remain as-is when compiled.
Also this + is not needed.
Comment #8
Aditya4478 CreditAttribution: Aditya4478 commentedplease completely ignore this.
Comment #9
Aditya4478 CreditAttribution: Aditya4478 commentedComment #10
Aditya4478 CreditAttribution: Aditya4478 commentedComment #11
Aditya4478 CreditAttribution: Aditya4478 commentedDo not consider this patch
Comment #12
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedI think this is a perfect example where we can use CSS logical properties and just use margin-inline-start to cover the LTR and RTL padding definitions. https://css-tricks.com/css-logical-properties/.
Comment #13
Aditya4478 CreditAttribution: Aditya4478 commentedFor D9 there are now changes found. For D10 please consider this patch.
Comment #14
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedLet's put this 0.0625rem to a local variable.
Comment #15
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedThis RTL change should remain as it was here.
As mentioned above, I think the only change for d9 is to use the local variable for the 0.0625rem value.
Comment #16
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedAlso, please check https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties. We may need to use more logical properties here, such as
min-block-size
.Comment #17
Aditya4478 CreditAttribution: Aditya4478 commentedComment #18
Aditya4478 CreditAttribution: Aditya4478 commentedComment #19
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedWe defined the new variable above so we can reuse it also here. So it shouldn't be named spacing because it's used in calculating the height and the background position. What is this value actually? I don't think it's a container-required spacing - maybe that was just copied from somewhere else?
Comment #20
Aditya4478 CreditAttribution: Aditya4478 commented"--positioning-elements" sounds good ?
Comment #21
Aditya4478 CreditAttribution: Aditya4478 commentedComment #23
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedLet's name it something like
--file--offset
and fix the failing test.Comment #24
Aditya4478 CreditAttribution: Aditya4478 commentedComment #25
Aditya4478 CreditAttribution: Aditya4478 commentedComment #26
hitaarthhTrial Patch.
Comment #27
hitaarthhPracticing
Comment #28
sasanikolic CreditAttribution: sasanikolic at Google Summer of Code commentedThis is funky, the comment jumped to the previous line. :)
Hi @hitaarthh. I can't see how are your changes different from the patches from @Aditya4478?
Changes look good to me.
Comment #29
hitaarthhhello @sasanikolic,
It was a trial patch as this was my first contribution in drupal, just getting hands on experience with drupal 9/10.
Are they any more issues opened related to CSS modernization or some frontend development where i can potentially contribute to?
Comment #30
lauriii@hitaarthh Welcome! If you are interested in helping on CSS refactoring, we have many CSS refactoring issues in the Claro issue queue. Here's a link for the Claro issue queue: https://www.drupal.org/project/issues/drupal?component=Claro+theme
Should we use this in both Drupal 10 and Drupal 9 since this would get compiled by PostCSS?
We can also remove the LTR comment since this now applies for both, LTR and RTL.
Comment #31
hitaarthh@lauriii Yeah i just started off contributing to drupal, will surely look into it.
Comment #32
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs commented@lauriii Made changes as per the comment #30.
Needs review.
Comment #33
smustgrave CreditAttribution: smustgrave at Mobomo commentedPatch failed to apply. You can test a patch before uploading with the core/scripts/dev/commit-code-check.sh
Comment #34
smustgrave CreditAttribution: smustgrave at Mobomo commentedSo what patch was the correct one? I see there were a number of trial patches and I think #32 may have been off one of those. So should we review #25?
Comment #35
_utsavsharma CreditAttribution: _utsavsharma at OpenSense Labs commentedSorry for the #32.
Made changes as per the comment #30.
Needs review.
Comment #36
Sakthivel M CreditAttribution: Sakthivel M at QED42 for Drupal India Association commentedUpdated #28 Comment, Please review the patch
Comment #38
ckrinaComment #39
ckrinaComment #40
Gauravvvv CreditAttribution: Gauravvvv at Axelerant for Drupal India Association commentedAdded variables on component level. please review
Comment #41
smustgrave CreditAttribution: smustgrave at Mobomo commentedNesting looks good
But not sure if these spaces are needed
Comment #42
Gauravvvv CreditAttribution: Gauravvvv at Axelerant for Drupal India Association commentedEven without spaces in pcss.css file, compiled CSS file have the space after declared variable. I think we need these space to differentiate between variables and properties.
Comment #43
smustgrave CreditAttribution: smustgrave at Mobomo commentedIf that's the case then this should be fine.
Comment #44
lauriiiThese variables don't seem particularly helpful at least with the current naming 🤔 I think we need to either rename to something that explains what is their purpose in this component or just remove.
This should be added to the
.file
rule.Comment #46
kunal_sahu CreditAttribution: kunal_sahu at Valuebound for Valuebound commentedAs per @lauriii's suggestion in #44, I have made changes to the .file rule.
Attaching the patch along with interdiff.
Kindly review. And please guide me if you find my changes inappropriate.
Thanks
Comment #47
Akram KhanComment #48
Akram KhanAdded updated patch and fixed CCF #46
Comment #49
smustgrave CreditAttribution: smustgrave at Mobomo commentedHiding patches #46 and #48
.file .file__size {
color: var(--file-size-color);
}
Is undoing some of the nesting previously done
And neither seem to address #44.1 so least do a restart back to #40 before continuing this forward.
So starting from #40 lets address the points in #44
Comment #50
Akram KhanComment #51
Stanzin CreditAttribution: Stanzin as a volunteer commented// Ignore this patch
I am new to env. Checking the patch works or not.
Comment #52
Gauravvvv CreditAttribution: Gauravvvv at Axelerant for Drupal India Association commentedAddressed #44, attached patch and interdiff with #40 for same. please review
Comment #53
smustgrave CreditAttribution: smustgrave at Mobomo commented#44 seems to be addressed.
Comment #55
smustgrave CreditAttribution: smustgrave at Mobomo commentedSeems random failure.
Comment #57
kunal_sahu CreditAttribution: kunal_sahu at Valuebound for Valuebound commentedI reviewed this Patch and doesn't seem to have any issue. The patch LGTM. But the error message that is mentioned typically appears in PHPUnit tests when an assertion is made that an object or array should be empty, but it is not.
It is not related to the CSS code itself.
So i guess we can move it to RTBC.
Thanks
Comment #58
smustgrave CreditAttribution: smustgrave at Mobomo commentedRandom failure
Comment #60
smustgrave CreditAttribution: smustgrave at Mobomo commentedTicket isn’t having luck with random failures
Comment #62
Santosh_Verma CreditAttribution: Santosh_Verma at Material for Drupal India Association commentedTested the patch #52 which is is showing fail testing,
It is applying cleanly.I think failure is not related to patch
Comment #64
Gauravvvv CreditAttribution: Gauravvvv at Axelerant for Drupal India Association commentedPatch #52, still applies on 11.x. Restoring the status
Comment #66
lauriiiCommitted 9cd4453 and pushed to 11.x. Thanks!
Comment #68
quietone CreditAttribution: quietone at PreviousNext commentedThis is a minor only change, removing tag for the followup.