Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For accessibility reasons (for people only using keyboard to navigate), the popover should have the possibility to be closed by pressing ESC.
Comment | File | Size | Author |
---|---|---|---|
#17 | 2882175-17.patch | 10.3 KB | markhalliwell |
#17 | interdiff-2882175-14-17.txt | 10.24 KB | markhalliwell |
Comments
Comment #2
sylvainar CreditAttribution: sylvainar commentedComment #3
sylvainar CreditAttribution: sylvainar commentedComment #4
sylvainar CreditAttribution: sylvainar commentedFixed a typo on the second patch.
Comment #5
mgiffordAlways good to have a few external links:
https://bitsofco.de/accessible-modal-dialog/#6allowtheesckeytoclosethedi...
https://simplyaccessible.com/article/closing-modals/
https://medium.com/@matuzo/writing-javascript-with-accessibility-in-mind...
Comment #6
sylvainar CreditAttribution: sylvainar commentedWhen you press ESC everywhere in the site if there is no popup, you got an error in the console. I modified the patch.
Comment #7
sylvainar CreditAttribution: sylvainar commentedFix typo
Comment #8
sylvainar CreditAttribution: sylvainar commentedFix typo
Comment #9
markhalliwellI'm all for adding accessibility, however this feature further deviates from the native Bootstrap plugin (more so than it already has).
To keep BC, I would say this would also need a setting that could be disabled if such functionality is not desired, for whatever reason.
---
This should be
.on('keyup.bs.popover', function (e) {
instead.Comment should be above the method/anonymous function invocation with a space before it as well (in between chain).
Also, there's no need for two
if
code blocks here, just use one with&&
.Comment #10
markhalliwellbump...
Comment #11
markhalliwellbump... again...
Comment #12
sylvainar CreditAttribution: sylvainar as a volunteer commentedWow, it's been a while actually…
I corrected the patch according to your review, and added a parameter in the theme configuration.
Comment #14
sylvainar CreditAttribution: sylvainar as a volunteer commentedFail, I submitted an empty patch…
This one should work.
Comment #15
sylvainar CreditAttribution: sylvainar as a volunteer commentedComment #16
markhalliwellAgain, this should be
.on('keyup.bs.popover', function (e) {
.That being said, it really shouldn't be bound at all unless the setting is enabled.
This shouldn't be using the global setting. Individual popups may have this option manually configured. This should retrieve the option from
$currentPopover
itself.Comment #17
markhalliwellOk. I've gone through the existing code and the above patches.
The more I looked at it, the more I realized it made very little difference to have an additional setting just for escape.
Furthermore, the existing
popover_trigger_autoclose
setting doesn't really make a lot of sense, name wise; so I've renamed itpopover_auto_close
and combined all the existing functionalty with the new functionality as a single setting.The description of the new setting explains in great detail when an automatic close will happen.
I've also gone ahead and created a change record for this issue.
Comment #19
loopduplicateWhile browsing anonymously, I get "Uncaught Error: Syntax error, unrecognized expression: unsupported pseudo: focusable". From a quick internet search, it appears as though this pseudo selector is only available if jQuery UI is loaded.
Hopefully I'll figure out a nice fix today. If I do, I'll create a separate issue with a patch and link back to this one.
Comment #20
loopduplicateI added a new issue with a patch to address the issue I brought up in #19. https://www.drupal.org/project/bootstrap/issues/3013236#comment-12853020