Not attending DrupalCon Vienna 2025? We would love to hear why. Your feedback helps us understand the community better.In #2882175: Accessibility: Close popover when ESC is pressed, code was added which assumes that jQuery UI is loaded. This results in the following error: "Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: focusable" if the sub theme doesn't use jQuery UI, which is commonly the case for anonymous visitors. Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3013236-3.patch | 1.49 KB | markhalliwell |
Comments
Comment #2
loopduplicate commentedHere's a patch which pulls the anonymous behavior function out into a named function and later checks to see if jquery.ui is available before attempting to use :focusable.
Comment #3
markhalliwell#2 isn't really much of a solution since it would work some of the time and just confuse people with unknown "random" behavior.
We can just get away with using
:visibleinstead. It was merely meant as a way to activate jQuery's "global focus" magic.Comment #5
loopduplicate commentedThanks for the commit. I see how my approach was wrong now, whoops. I figured my approach wouldn't be the one that got accepted but I needed a bandaid last night :)
Comment #6
markhalliwelljQuery UI can still be loaded on some pages were certain widgets like drag/resize that are commonly used throughout Drupal sites.
This means that some users will be able to close by losing focus on another element and some won't and the popover would still be visible.
Thus, this can lead to what some users would classify as "random" because they wouldn't know why it would close on some pages and not others.
Comment #7
loopduplicate commentedYeah, sorry Mark. I was tired and read the code wrong the first time. I didn't realize that you were using the second parameter as delegation. For some reason, my brain was thinking you were using multiple selectors in the first argument. Sigh. Guess that's what I get for jumping back and forth from front end and back end so much and for taking a couple of months off, pretty much :) Cheers.
Comment #8
markhalliwellHeh, no worries. I'm the one who introduced this bug, so... we all make mistakes :D
Comment #9
markhalliwellFTR/explanation: the reason #2 appeared to work for you last night is because it essentially removed the entire focus code from play.
Doesn't actually do anything because there really isn't a global "focus" event. That's why the second delegate parameter is needed so it triggers jQuery's magic (it's not a widely known or documented feature).
Doesn't actually do anything because
:focusableisn't a valid event to bind, or rather... nothing actually triggers an event with that name.Comment #10
markhalliwellFYI, I've been using Bootstrap's popover demo code in a random node to test all this:
https://monosnap.com/file/BxlEyoMrAVmax1hU9DqLFx6jomcIf5
edit: updated screencast URL, which includes fix from #3013402: Popover data-auto-close attribute not respected
Comment #11
ressa commentedI just noticed this warning:
Thanks for fixing it! Is there a temporary solution until the patch is included in the official release, or is a fresh release close?
Comment #12
markhalliwellJust use the patch until another release is made. I may do another one later this month or perhaps next month... just have to see how it falls.
Comment #13
ressa commentedSure. For others, here is an article on How to apply patches in Drupal 8 with Composer, and the bit for this patch:
Comment #14
loopduplicate commentedYou can also get the dev version, which already includes the patch.
Comment #15
ressa commentedI know @loopduplicate, and thanks for the tip, but I need to use the latest stable release in composer.json.