Problem/Motivation

These changes are coming from the feedback that we've received from the patch submission that we've made on 9/23/2020.

  1. +++ b/core/themes/olivero/css/components/header-search-narrow.pcss.css
    @@ -0,0 +1,174 @@
    +  form {
    

    We could make this element of the .search-block.

  2. +++ b/core/themes/olivero/css/components/header-search-wide.pcss.css
    @@ -0,0 +1,292 @@
    +.search-wide__wrapper {
    

    This could be just .block-search--wide.

  3. +++ b/core/themes/olivero/css/components/header-search-wide.pcss.css
    @@ -0,0 +1,292 @@
    +.search-wide__grid {
    

    This should probably also be an element of .block-search.

  4. +++ b/core/themes/olivero/css/components/header-search-wide.pcss.css
    @@ -0,0 +1,292 @@
    +    .icon--search {
    

    This should be an element of .block-search.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

proeung created an issue. See original summary.

proeung’s picture

Issue summary: View changes
proeung’s picture

Title: [Code Review] header-search-wide.pcss.css partial adjustments » [Code Review] header-search-wide.pcss.css and header-search-narrow.pcss.css adjustments
proeung’s picture

Issue summary: View changes
proeung’s picture

Issue summary: View changes
proeung’s picture

Issue summary: View changes
mherchel’s picture

Title: [Code Review] header-search-wide.pcss.css and header-search-narrow.pcss.css adjustments » Olivero header-search-wide.pcss.css and header-search-narrow.pcss.css adjustments
Project: Olivero » Drupal core
Version: 8.x-1.x-dev » 9.1.x-dev
Component: Code » Olivero theme
mherchel’s picture

Version: 9.1.x-dev » 9.2.x-dev
Issue tags: +CSS, +FLDC2021
FileSize
29.95 KB

Patch attached!

mherchel’s picture

Status: Active » Needs review
proeung’s picture

Status: Needs review » Needs work

@mherchel Code looks good overall, but the patch in #8 needs to be re-roll for 9.2.x-dev.

ankithashetty’s picture

Status: Needs work » Needs review
FileSize
29.87 KB
10.92 KB

Rerolled the patch in #8 and fixed the custom commands failure errors, thanks!

andy-blum’s picture

djsagar’s picture

HI all,

Rolling up patch 13 to fix failed custom commands Failed in patch #12, which i found after run post css command please review.

Thanks

mherchel’s picture

Re-roll of #13 attached.

Gauravvvv’s picture

@mherchel, the Semicolon is missing for some CSS properties in patch #14.

-[dir="ltr"] .search-narrow__wrapper input[type="search"] {
+[dir="ltr"] .block-search-narrow input[type="search"] {
     padding-left: 1.125rem
 }
 
-[dir="rtl"] .search-narrow__wrapper input[type="search"] {
+[dir="rtl"] .block-search-narrow input[type="search"] {
     padding-right: 1.125rem
 }
 
-[dir="ltr"] .search-narrow__wrapper input[type="search"] {
+[dir="ltr"] .block-search-narrow input[type="search"] {
    padding-right: 1.125rem
 }
 
-[dir="rtl"] .search-narrow__wrapper input[type="search"] {
+[dir="rtl"] .block-search-narrow input[type="search"] {
     padding-left: 1.125rem
 }
andy-blum’s picture

@Gauravmahlawat that file is automatically generated from the front-end tooling. See this stackoverflow comment regarding semicolons in CSS blocks

andy-blum’s picture

Patch #14 applies cleanly and seems to have passed all the tests, however I wanted to point out that the issue description recommended implementing .block-search--wide, I assume to use BEM standards, but the patch currently implements .block-search-wide essentially creating a new BEM block.

If that's not an issue, then +1 for RTBC

mherchel’s picture

Status: Needs review » Needs work

Thanks for the review!

I wanted to point out that the issue description recommended implementing .block-search--wide, I assume to use BEM standards, but the patch currently implements .block-search-wide essentially creating a new BEM block.

Yeah, thats intentional. To me the differences are enough that it warrants a new block. We also have the code split out into multiple CSS files.

Review and requested changes incoming

mherchel’s picture

  1. +++ b/core/themes/olivero/js/search.es6.js
    @@ -1,6 +1,8 @@
    +  const searchWideButton = document.querySelector('.block-search-wide__button');
    

    While we're refactoring, let's add data attributes onto all of the selectors that JavaScript is querying. This is per Drupal coding standards (see #3153234: [Meta] Olivero JavaScript should be selecting [data-drupal-selector] attributes where possible).

    Something like data-search-wide-button, etc

  2. +++ b/core/themes/olivero/js/search.es6.js
    @@ -40,13 +42,15 @@
    +        '.block-search-wide__wrapper, .block-search-wide__wrapper *',
    

    This can also use the data attribute selectors

kiran.kadam911’s picture

Thanks, @mherchel for the patch, and Thanks @andy-blum for the review.

Kindly review the updated patch based on #19.

Thanks!

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mherchel’s picture

Status: Needs review » Needs work

There's a prettier error on the patch. Run yarn prettier to fix it.

mherchel’s picture

Other than that, it looks great!

Gauravvvv’s picture

Re-rolled patch #20.
Attached interdiff for the same.

Please ignore a/core/misc/ajax.js | a/core/misc/jquery.cookie.shim.js in interdiff. these files are not included in patch.

Gauravvvv’s picture

Status: Needs work » Needs review
mherchel’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
544 bytes

The interdiff in #24 contains some irrelevant changes that are not in the actual patch. I'm attaching the correct interdiff between #20 and #24 here.

Passes tests, and looks perfect. RTBC!

I also adjusted the credits.

lauriii’s picture

Status: Reviewed & tested by the community » Needs review
  1. +++ b/core/themes/olivero/css/components/header-search-wide.pcss.css
    @@ -182,16 +182,16 @@
    +.block-search-wide__button {
    
    @@ -226,14 +226,12 @@
    +    & .block-search-wide__button-close {
    

    Does this have to be nested still?

  2. +++ b/core/themes/olivero/templates/block/block--secondary-menu--plugin-id--search-form-block.html.twig
    @@ -35,14 +35,14 @@
    +    <div{{ content_attributes.addClass('block-search-wide__wrapper').setAttribute('data-search-wide-wrapper', '') }}>
    

    Is there a specific reason not to use data-drupal-selector which is something we have been trying to standardize on?

mherchel’s picture

Status: Needs review » Needs work
+++ b/core/themes/olivero/css/components/header-search-wide.pcss.css
@@ -182,16 +182,16 @@
+.block-search-wide__button {

@@ -226,14 +226,12 @@
+    & .block-search-wide__button-close {

Does this have to be nested still?

Yep. It's nested under .block-search-wide__button[aria-expanded="true"], which is necessary to turn the icon into an X

+++ b/core/themes/olivero/templates/block/block--secondary-menu--plugin-id--search-form-block.html.twig
@@ -35,14 +35,14 @@
+    <div{{ content_attributes.addClass('block-search-wide__wrapper').setAttribute('data-search-wide-wrapper', '') }}>

Is there a specific reason not to use data-drupal-selector which is something we have been trying to standardize on?

I didn't know about using data-drupal-selector until recently. We'll make the change here.

mherchel’s picture

Status: Needs work » Needs review
FileSize
30.3 KB
3.9 KB

Updated patch and interdiff attached with changes to the JavaScript selector pattern.

kiran.kadam911’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
745.48 KB

@mherchel Thanks for the updated patch, it's applied successfully and working as expected.

Attaching just SS for reference instead of video.

Thanks!

  • lauriii committed 25de809 on 9.3.x
    Issue #3173012 by mherchel, kiran.kadam911, andy-blum, Gauravmahlawat,...
lauriii’s picture

Version: 9.3.x-dev » 9.2.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 25de809 and pushed to 9.3.x and 9.2.x. Thanks!

  • lauriii committed ed4a55c on 9.2.x
    Issue #3173012 by mherchel, kiran.kadam911, andy-blum, Gauravmahlawat,...

Status: Fixed » Closed (fixed)

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