Comments

mherchel created an issue. See original summary.

tushar_sachdeva’s picture

Assigned: Unassigned » tushar_sachdeva
tushar_sachdeva’s picture

Quick and easy patch attached. For ref, video is attached when a KeyboardEvent fire, you can test which keycode is pressed as for ESC key it's 27.

tushar_sachdeva’s picture

Assigned: tushar_sachdeva » Unassigned
tushar_sachdeva’s picture

Status: Active » Needs review
kishor_kolekar’s picture

Assigned: Unassigned » kishor_kolekar
kishor_kolekar’s picture

StatusFileSize
new1.45 KB
new1.38 KB

please review

kapilv’s picture

StatusFileSize
new1.45 KB
mherchel’s picture

Status: Needs review » Needs work

Tests are failing, but here's a quick review of #7

  1. +++ b/core/themes/olivero/js/search.es6.js
    @@ -2,6 +2,14 @@
    +    console.log(event.which);
    

    Errant console.

  2. +++ b/core/themes/olivero/js/search.es6.js
    @@ -2,6 +2,14 @@
    +    if (event.keyCode == 27) {
    

    Instead of e.keycode, use e.key === 'Escape' || e.key === 'Esc'

  3. +++ b/core/themes/olivero/js/search.es6.js
    @@ -2,6 +2,14 @@
    +      searchWideWrapper.classList.remove('is-active');
    

    Instead of manually changing attributes, use the toggleSearchVisibility function.

Be sure to run yarn prettier after your edits to make sure prettier doesn't fail.

tushar_sachdeva’s picture

tushar_sachdeva’s picture

StatusFileSize
new1.26 KB
new1.54 KB

The new patch with interdiff is attached, with the changes mentioned above in #9. Please review and verify it.

tushar_sachdeva’s picture

Assigned: tushar_sachdeva » Unassigned
tushar_sachdeva’s picture

Status: Needs work » Needs review
mherchel’s picture

Status: Needs review » Needs work

Getting an error within CI

  7:7  error  'toggleSearchVisibility' was used before it was defined  no-use-before-define
tushar_sachdeva’s picture

Assigned: Unassigned » tushar_sachdeva
sakthivel m’s picture

Status: Needs work » Needs review
StatusFileSize
new1.84 MB

Hi @mherchel

when i pressed ESC key, the search form popup closed. it's working fine in without patch, Attached video here.

Please correct me if i missed anything here

tushar_sachdeva’s picture

StatusFileSize
new1.95 KB
new1.09 KB

Hope this will work fine , please review .

aaron.ferris’s picture

Patch from #17 applies cleanly for me and does what id expect it to do.

Would we want to keep the es6 file consistent in the usage of arrow functions?

IE:

  document.addEventListener('keydown', (e) => {
    if (e.key === 'Escape' || e.key === 'Esc') {
      toggleSearchVisibility(false);
    }
  });
tushar_sachdeva’s picture

Assigned: tushar_sachdeva » Unassigned
abhijith s’s picture

StatusFileSize
new394.66 KB

Applied patch #17 and it works.The search form is closing when pressing the ESC key.Screen recording added.

RTBC +1

aaron.ferris’s picture

Attaching a patch based off @tushar_sachdeva's patch in #17 but with an arrow function in the es6 file for consistency.

mherchel’s picture

Status: Needs review » Needs work

This is looking really close. Thanks everyone for working on it!

+++ b/core/themes/olivero/js/search.es6.js
@@ -29,6 +29,12 @@
+  document.addEventListener('keydown', (e) => {

Lets use the keyup event. The only reason being consistency (we're using keyup in navigagtion.es6.js and second-level-navigation.es6.js)

+++ b/core/themes/olivero/js/search.es6.js
@@ -29,6 +29,12 @@
   Drupal.olivero.toggleSearchVisibility = toggleSearchVisibility;

Move the new code below this line. We want the reference to toggleSearchVisibility to appear directly below where it was originally defined.

paulocs’s picture

StatusFileSize
new1.15 KB

Here is the patch addressing comment #22.

paulocs’s picture

Status: Needs work » Needs review
paulocs’s picture

I really don't know what triggered the error.

tushar_sachdeva’s picture

@paulocs make sure that you have run yarn prettier after your edits to make sure prettier doesn't fail.

paulocs’s picture

I ran it. I ran yarn prettier but found no problem in the lines that I added in the patch.
Maybe I'm doing it wrong because its my first time using it.
When I run it, it fixes other lines in the file but there are no change in the lines that I added.

aaron.ferris’s picture

I can’t see anything obvious wrong with the patch, the output of the failure suggests the file isn’t supported.

aaron.ferris’s picture

Weird, but I think its a problem with the files not matching. Even with the es6 file at default the test fails locally. I've started from scratch, yarn run build:js and attaching a patch that should pass

Local:
Checking core/themes/olivero/js/search.es6.js
core/themes/olivero/js/search.es6.js passed

Checking core/themes/olivero/js/search.js
core/themes/olivero/js/search.js passed

Did you run yarn run build:js locally? That's the only thing I can think of.

mherchel’s picture

Status: Needs review » Reviewed & tested by the community

#29 looks good to me. Thanks again for working on this.

  • lauriii committed 1af77ea on 9.2.x
    Issue #3209125 by tushar_sachdeva, aaron.ferris, kishor_kolekar, paulocs...
lauriii’s picture

Priority: Minor » Normal
Status: Reviewed & tested by the community » Fixed

Committed 1af77ea and pushed to 9.2.x. Thanks!

Status: Fixed » Closed (fixed)

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