Problem/Motivation

This is part of the CSS modernization initiative.

Steps to reproduce

The stylesheet at https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/themes/claro/css/components/form--select.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 and remove IE specific style definitions.

User interface changes

None. There should be no visual differences.
issue image

Comments

sasanikolic created an issue. See original summary.

aditya4478’s picture

Status: Active » Needs review
StatusFileSize
new7.53 KB
aditya4478’s picture

Version: 9.5.x-dev » 10.0.x-dev
StatusFileSize
new7.4 KB
ckrina’s picture

ckrina’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Postponed
Issue tags: +Needs Review Queue Initiative

This issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 200, following Review a patch or merge require as a guide.

Was discussed in slack #frontend channel slightly with @ckrina and @quietone
Moving to postponed as there are still some decisions to be made about how to go about these changes and what's needed in the follow up.

aditya4478’s picture

Status: Postponed » Needs work
stanzin’s picture

Version: 10.0.x-dev » 11.x-dev
Status: Needs work » Needs review
StatusFileSize
new5.03 KB
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: -Needs followup +Needs screenshots

Some weird indent in the .css file

Also as this seems to be different from #3 will need screenshots.

Please include interdiffs between patches as well.

Thanks!

santosh_verma’s picture

working on it

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new5.06 KB
new6.13 KB

Updated the logical properties and selectors, please review

Harish1688’s picture

StatusFileSize
new11 KB

Hi,

After applying the patch 3303551-11.patch, the following points were observed:

1. CSS Logical Properties and nesting are utilized appropriately.
2. The UI and hover/focus states remain unchanged, showing no difference in behavior compared to the previous version.

Screenshot attached

looks good to RTBC

smustgrave’s picture

Status: Needs review » Needs work
@media (forced-colors: active) {
  .form-element--type-select{
    &,
    &:focus,
    &[disabled] {
      padding-inline-end: var(--input-padding-horizontal);
      background-image: none;
      appearance: revert; /* Revert <select> appearance value for modern browsers. */
    }
  }

Believe this could go under .form-element--type-select also.

Also there are some missing spacing before the brackets. Super nitpicky but if the above is being fixed those should be too.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new1.43 KB
new5.59 KB

Addressed #13, attached interdiff for same

smustgrave’s picture

Status: Needs review » Needs work

For the sceenshots please

Harish1688’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new11 KB

hi,

As per #15 request attached the image in issue summary.
The UI should remain visually consistent before/after the patch applied, with no need to compare the screens before and after screen.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs screenshots
StatusFileSize
new63.78 KB

Verified the nesting seems seems good.

Found a random issue, not caused by this change, maybe will be fixed by the tooltip ticket though

tooltip

lauriii’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/core/themes/claro/css/components/form--select.pcss.css
    @@ -4,49 +4,35 @@
    -    background-image: none;
    -    appearance: revert; /* Revert <select> appearance value for modern browsers. */
    

    I don't think we should be removing these properties because they have been added intentionally to make select elements work consistently in high contrast mode.

  2. +++ b/core/themes/claro/css/components/form--select.pcss.css
    @@ -4,49 +4,35 @@
    +.no-touchevents .form-element--type-select{
    

    Nit: missing space before {

Harish1688’s picture

Status: Needs work » Needs review
StatusFileSize
new488 bytes
new5.59 KB
new9.65 KB
new9.69 KB

Hi,

As pr last comment #18, looking the two point.
1. After applying the #18 patch, tested the UI on High contrast mode but not found any inconsistently. so removing the properties, not put any impact on the UI. attached the reference images.

2. Missing space is resolved in 3303551-19.patch patch.

After patch in select box in high contrast mode.
issue image
issue image

gauravvvv’s picture

StatusFileSize
new5.49 KB
new2.13 KB

Updated some logical properties, also restored the code from comment #18. Attached interdiff for same please review.

aditya4478’s picture

Status: Needs review » Reviewed & tested by the community

All tests are passed,
LGTM ! :-)

lauriii’s picture

StatusFileSize
new5.49 KB
new1.46 KB

There was a small regression to some weight select fields because of extra space had sneaked into a selector. Addressed that, and moved the no-touchevents related styles inside the .form-element--type-select block.

  • lauriii committed 29107b55 on 11.x
    Issue #3303551 by Gauravvvv, Aditya4478, Harish1688, Stanzin, smustgrave...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 29107b5 and pushed to 11.x. Thanks!

Status: Fixed » Closed (fixed)

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