MDL-57557 theme_boost: tweak js popover settings
authorRyan Wyllie <ryan@moodle.com>
Thu, 9 Mar 2017 06:11:35 +0000 (06:11 +0000)
committerDan Poltawski <dan@moodle.com>
Fri, 10 Mar 2017 18:04:47 +0000 (18:04 +0000)
Added the focus trigger to non hover popovers so that they close when
they lose focus.

Also added a 500ms delay to hiding the hover triggered popover to give
time for clicking on the contents.

theme/boost/amd/build/loader.min.js
theme/boost/amd/src/loader.js

index 89873f6..d331f28 100644 (file)
Binary files a/theme/boost/amd/build/loader.min.js and b/theme/boost/amd/build/loader.min.js differ
index 51aff15..bfd6d50 100644 (file)
@@ -43,13 +43,17 @@ define(['jquery', './tether', 'core/event'], function(jQuery, Tether, Event) {
 
         // We do twice because: https://github.com/twbs/bootstrap/issues/10547
         jQuery('body').popover({
+            trigger: 'focus',
             selector: "[data-toggle=popover][data-trigger!=hover]"
         });
 
         jQuery("html").popover({
             container: "body",
             selector: "[data-toggle=popover][data-trigger=hover]",
-            trigger: "hover"
+            trigger: "hover",
+            delay: {
+                hide: 500
+            }
         });
 
         // We need to call popover automatically if nodes are added to the page later.