MDL-57557 theme_boost: tweak js popover settings

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.
This commit is contained in:
Ryan Wyllie 2017-03-09 06:11:35 +00:00 committed by Dan Poltawski
parent 91b2bf2c9d
commit 77f591831c
2 changed files with 6 additions and 2 deletions

View File

@ -1 +1 @@
define(["jquery","./tether","core/event"],function(a,b,c){return window.jQuery=a,window.Tether=b,require(["theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(){a("body").popover({selector:"[data-toggle=popover][data-trigger!=hover]"}),a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover"}),c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:'[data-toggle="popover"]',trigger:"focus"})})})}),{}}); define(["jquery","./tether","core/event"],function(a,b,c){return window.jQuery=a,window.Tether=b,require(["theme_boost/util","theme_boost/alert","theme_boost/button","theme_boost/carousel","theme_boost/collapse","theme_boost/dropdown","theme_boost/modal","theme_boost/scrollspy","theme_boost/tab","theme_boost/tooltip","theme_boost/popover"],function(){a("body").popover({trigger:"focus",selector:"[data-toggle=popover][data-trigger!=hover]"}),a("html").popover({container:"body",selector:"[data-toggle=popover][data-trigger=hover]",trigger:"hover",delay:{hide:500}}),c.getLegacyEvents().done(function(b){a(document).on(b.FILTER_CONTENT_UPDATED,function(){a("body").popover({selector:'[data-toggle="popover"]',trigger:"focus"})})})}),{}});

View 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 // We do twice because: https://github.com/twbs/bootstrap/issues/10547
jQuery('body').popover({ jQuery('body').popover({
trigger: 'focus',
selector: "[data-toggle=popover][data-trigger!=hover]" selector: "[data-toggle=popover][data-trigger!=hover]"
}); });
jQuery("html").popover({ jQuery("html").popover({
container: "body", container: "body",
selector: "[data-toggle=popover][data-trigger=hover]", 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. // We need to call popover automatically if nodes are added to the page later.