Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sylvainar created an issue. See original summary.

sylvainar’s picture

Issue summary: View changes
FileSize
491 bytes
sylvainar’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Status: Active » Needs review
sylvainar’s picture

FileSize
491 bytes

Fixed a typo on the second patch.

sylvainar’s picture

FileSize
533 bytes

When you press ESC everywhere in the site if there is no popup, you got an error in the console. I modified the patch.

sylvainar’s picture

FileSize
533 bytes

Fix typo

sylvainar’s picture

FileSize
548 bytes

Fix typo

markhalliwell’s picture

Title: Accessibility : Close popover when ESC is pressed » Accessibility: Close popover when ESC is pressed
Status: Needs review » Needs work
Issue tags: +needs backport to 7.x-3.x

I'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.

---

  1. +++ b/js/popover.js
    @@ -60,6 +60,15 @@ var Drupal = Drupal || {};
    +          .keyup(function (event) {
    

    This should be .on('keyup.bs.popover', function (e) { instead.

  2. +++ b/js/popover.js
    @@ -60,6 +60,15 @@ var Drupal = Drupal || {};
    +            // Close popup when ESC is pressed.
    

    Comment should be above the method/anonymous function invocation with a space before it as well (in between chain).

  3. +++ b/js/popover.js
    @@ -60,6 +60,15 @@ var Drupal = Drupal || {};
    +            if (event.which === 27) {
    +              if($currentPopover) {
    

    Also, there's no need for two if code blocks here, just use one with &&.

markhalliwell’s picture

bump...

markhalliwell’s picture

Assigned: sylvainar » Unassigned

bump... again...

sylvainar’s picture

Assigned: Unassigned » sylvainar
Status: Needs work » Needs review
FileSize
0 bytes

Wow, it's been a while actually…

I corrected the patch according to your review, and added a parameter in the theme configuration.

Status: Needs review » Needs work

The last submitted patch, 12: close-popover-on-esc-2882175-12.patch, failed testing. View results

sylvainar’s picture

Fail, I submitted an empty patch…

This one should work.

sylvainar’s picture

Status: Needs work » Needs review
markhalliwell’s picture

Status: Needs review » Needs work
  1. +++ b/js/popover.js
    @@ -65,6 +66,16 @@ var Drupal = Drupal || {};
    +          .keyup(function (event) {
    

    Again, 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.

  2. +++ b/js/popover.js
    @@ -65,6 +66,16 @@ var Drupal = Drupal || {};
    +            if ($.fn.popover.Constructor.DEFAULTS.closeOnEscape
    

    This shouldn't be using the global setting. Individual popups may have this option manually configured. This should retrieve the option from $currentPopover itself.

markhalliwell’s picture

Assigned: sylvainar » Unassigned
Status: Needs work » Fixed
Issue tags: -needs backport to 7.x-3.x
FileSize
10.24 KB
10.3 KB

Ok. 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 it popover_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.

  • markcarver committed 502bfbf on 8.x-3.x
    Issue #2882175 by sylvainar, markcarver: Accessibility: Close popover...
loopduplicate’s picture

While 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.

loopduplicate’s picture

I 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

Status: Fixed » Closed (fixed)

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