Problem/Motivation

This is part of the CSS modernization initiative, and intended to be worked on by our Google Summer of Code student only. This is intended to be a straightforward second issue to easily onboard the student.

The first issue was regarding the autocomplete-loading.module stylesheet.

Steps to reproduce

The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/themes/claro/css/components/autocomplete-loading.module.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.

Issue fork drupal-3294001

Command icon 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

sasanikolic created an issue. See original summary.

aditya4478’s picture

Status: Active » Needs review
StatusFileSize
new6.01 KB
sasanikolic’s picture

Status: Needs review » Needs work
+++ b/core/themes/claro/css/components/autocomplete-loading.module.pcss.css
@@ -30,29 +30,31 @@
+  &::-ms-clear {

I think this can be gone, since it's IE related.

aditya4478’s picture

Status: Needs work » Needs review
StatusFileSize
new5.88 KB

Ignore this patch because it not contains IE blocks

aditya4478’s picture

StatusFileSize
new6.81 KB

Please ignore this patch, By-mistake i placed different patch here

aditya4478’s picture

Version: 9.5.x-dev » 10.0.x-dev
StatusFileSize
new7.17 KB

Needs improvement, ignore this patch

aditya4478’s picture

Version: 10.0.x-dev » 9.5.x-dev
StatusFileSize
new5.18 KB

No proper nesting done. Ignore this patch

aditya4478’s picture

StatusFileSize
new2.23 KB

Proper nesting done.

aditya4478’s picture

Version: 9.5.x-dev » 10.0.x-dev
StatusFileSize
new4.95 KB

Nesting is done. rtl statement is normalized & css logical property is used.

aditya4478’s picture

consider #8 and #9 patches

sasanikolic’s picture

Status: Needs review » Needs work

I think we can do some more nesting improvements here. Can't we also. nest these selectors .js .form-autocomplete.is-autocompleting and maybe rtl ones too?

aditya4478’s picture

Version: 10.0.x-dev » 9.5.x-dev
Status: Needs work » Needs review
StatusFileSize
new5.8 KB

Noted.

sasanikolic’s picture

Status: Needs review » Needs work

That looks quite good to me, but needs another pair of eyes to pass.

sasanikolic’s picture

Status: Needs work » Needs review

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

ckrina’s picture

shivam-kumar’s picture

StatusFileSize
new4.38 KB

Refactored the patch for 10.1.x, as the patch failed to apply in #12.

shivam-kumar’s picture

StatusFileSize
new4.18 KB

Fixed CCF of #17

smustgrave’s picture

Status: Needs review » Needs work

If this is suppose to use nesting shouldn't

[dir="rtl"] .claro-autocomplete__message {

.js .form-autocomplete {

be nested?

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new4.66 KB
new2.89 KB

Updated few selectors and improved nesting. Please review

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Nesting appears to be correct.

Checking that the .css file is unchanged, to show nothing actually changed, and only change

+.js[dir="rtl"] .form-autocomplete {
+  background-image: url("data:image/svg+xml,%3csvg width='40' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 1c4.54-.173 8.188 4.787 6.687 9.068-1.176 4.384-6.993 6.417-10.637 3.7-.326-.39-.565.276-.846.442l-3.74 3.739-1.413-1.414 4.35-4.35C3.59 8.717 5.25 2.938 9.462 1.475A7.003 7.003 0 0112 1zm0 2c-3.242-.123-5.849 3.42-4.777 6.477.842 3.132 4.994 4.58 7.6 2.65 2.745-1.73 2.9-6.125.285-8.044A5.006 5.006 0 0012 3z' fill='%23868686'/%3e%3c/svg%3e");
+  background-position: 0 50%;
+}

Seems to just have moved which I don't see as an issue.

bnjmnm’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/claro/css/components/autocomplete-loading.module.pcss.css
@@ -61,7 +68,9 @@
+[dir="rtl"] {
+  & .claro-autocomplete__message {
+    right: auto;
+    left: 0;
+  }

One of the requests of this issue is to use logical properties where possible. This RTL styling can be removed entirely by changing the LTR version to use inset-inline-end instead of right https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new5.08 KB
new1.33 KB

Addressed #22. Please review

smustgrave’s picture

Status: Needs review » Needs work

There are still other references to [dir="rtl"] should they not be removed?

And this was previously tagged for a follow up if that can be addressed? Think there was something in the #frontend channel but not sure.

gauravvvv’s picture

gauravvvv’s picture

Status: Needs work » Needs review

There are still other references to [dir="rtl"] should they not be removed?

here RTL is adding a new icon, so I don't think so we should remove it.
I have added a patch with some more css refactor. Added before and after patch screenshot. Please review

[dir="rtl"] {
   & .form-autocomplete {
     background-image: url(../../images/icons/868686/magnifier-rtl.svg);
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs followup +Needs Review Queue Initiative

Don't think the follow up is needed anymore.

Thanks.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 25: 3294001-25.patch, failed testing. View results

thakursachin05 made their first commit to this issue’s fork.

gauravvvv’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated failure. restoring status

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 25: 3294001-25.patch, failed testing. View results

stanzin’s picture

Status: Needs work » Needs review
StatusFileSize
new5.47 KB

new patch for D11.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

#25 still applied to 11.x branch.

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new85 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

shmy made their first commit to this issue’s fork.

shmy’s picture

I've converted the #35 patch to a MR.

akshayadhav’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Need to know what was changed in #35, no interdiff was provided or comment

#25 was previously RTBC not #35.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new10.17 KB

Patch #25 still applies; there is no need for new patches. I have added an interdiff between Patch #25 and #35. In Patch #35, logical properties that are not needed here are being removed.

smustgrave changed the visibility of the branch 10.1.x to hidden.

smustgrave changed the visibility of the branch 11.x to hidden.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Agreed, hiding the MRs and patches after 25. If there is something wrong with it then it should be noted.

  • nod_ committed 71c9b9f7 on 11.x
    Issue #3294001 by Aditya4478, Gauravvvv, shivam-kumar, smustgrave,...
nod_’s picture

Status: Reviewed & tested by the community » Fixed

Used #25 for commit.

Committed 8ab1f3c and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.