Opened by @bronzehedwick in Olivero project queue

Problem/Motivation

When the search menu is open, clicking on the "X" should close/collapse the search menu. Instead, the display flickers, and the menu stays open. Clicking anywhere outside the menu collapses the menu as normal.

Tested on a vanilla Drupal instance.

Steps to reproduce

  1. Click the search icon
  2. Click the "X" now exposed
  3. Notice the search menu stays open

Issue fork drupal-3303112

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andy-blum created an issue. See original summary.

mherchel’s picture

Status: Active » Postponed (maintainer needs more info)

I'm unable to reproduce this. We also have test coverage for this interaction.

Are there any additional steps to reproduce? (browser, etc?)

andy-blum’s picture

This issue is only in Safari - assuming it's related to the issues with webkit not giving buttons focus on click. Adding a related issue.

andy-blum’s picture

Also adding a link to the webkit bug tracker for this: https://bugs.webkit.org/show_bug.cgi?id=229895

mherchel’s picture

Title: Clicking "X" when search is open does not collapse the search » Olivero: When in Safari, clicking "X" when search is open does not collapse the search
Status: Postponed (maintainer needs more info) » Active

Ahh yeah, I see the issue in Safari

andy-blum’s picture

Status: Active » Needs review
andy-blum’s picture

bronzehedwick’s picture

Tested @andy-blum patch against a plain Drupal 9 site, and it fixed the issue in Safari for me. Code looks good to me as well. Thanks!

bronzehedwick’s picture

Status: Needs review » Reviewed & tested by the community
mherchel’s picture

This is great! I spent some time on this yesterday and had to give up as I had to move onto something else. Solving this is more difficult than I thought it would be.

Leaving as RTBC, but I added some comments and questions.

andy-blum’s picture

Status: Reviewed & tested by the community » Needs review
mherchel’s picture

Status: Needs review » Needs work

Setting back to needs work because of an IE11 incompatibility with element.closest().

All of the rest of the code works great, and I tested with Safari, Chrome, and Firefox.

We also need a D10 patch.

ravi.shankar’s picture

Added a patch for Drupal 10.1.x and added reroll diff between MR and patch.

Still needs work for #13.

andy-blum’s picture

#13 shouldn't be an issue, as core polyfills Element.prototype.closest(). Do we need to do anything specific to make sure that's included or does Olivero already include core's polyfills?

mherchel’s picture

Looks like Olivero already includes it as a dependency of our global styling. That being said, we really need to be explicit in our library definitions and include it as a dependency of the olivero/search-wide library.

I'd personally be okay with adding it as is, but I don't believe that it'll get by through the commit review without this change.

mherchel’s picture

Status: Needs work » Needs review
FileSize
8.83 KB

Replaced the usage of Element.closest() with Element.matches() since the whole point was to see if the focused element is within the search bar.

Also created a 10.1.x patch based off of the MR.

Abhijith S’s picture

Applied MR 2627 on 9.5.x.The search menu is collapsing on clicking the X button, after applying this patch.Attaching screen recordings for reference.

mherchel’s picture

Status: Needs review » Reviewed & tested by the community

Setting to RTBC based on ☝️

  • lauriii committed 45132e0 on 10.1.x
    Issue #3303112 by andy-blum, mherchel, Abhijith S, bronzehedwick:...

  • lauriii committed 44a6c2a on 10.0.x
    Issue #3303112 by andy-blum, mherchel, Abhijith S, bronzehedwick:...

lauriii’s picture

Version: 9.5.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed 45132e0 and pushed to 10.1.x. Also cherry-picked to 10.0.x, 9.5.x and 9.4.x. Thanks!

  • lauriii committed 09255a5 on 9.5.x
    Issue #3303112 by andy-blum, mherchel, Abhijith S, bronzehedwick:...

  • lauriii committed 4c2dafc on 9.4.x
    Issue #3303112 by andy-blum, mherchel, Abhijith S, bronzehedwick:...

Status: Fixed » Closed (fixed)

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