mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 07:16:17 -04:00
Fixed some edge cases for popover triggering
This commit is contained in:
parent
a15034b03e
commit
e8e5eb9c53
3 changed files with 22 additions and 10 deletions
|
@ -155,9 +155,20 @@ OperationsWaiter.prototype.getSelectedOp = function(ops) {
|
|||
*/
|
||||
OperationsWaiter.prototype.opListCreate = function(e) {
|
||||
this.manager.recipe.createSortableSeedList(e.target);
|
||||
// Allows popover to gain focus for eg. pressing buttons/scrolling
|
||||
$(".operation").popover({trigger: "manual", html: true, animation: true})
|
||||
.on("mouseenter", function () {
|
||||
this.enableOpsListPopovers(e.target);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Sets up popovers, allowing the popover itself to gain focus which enables scrolling
|
||||
* and other interactions.
|
||||
*
|
||||
* @param {Element} el - The element to start selecting from
|
||||
*/
|
||||
OperationsWaiter.prototype.enableOpsListPopovers = function(el) {
|
||||
$(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]")
|
||||
.popover({trigger: "manual"})
|
||||
.on("mouseenter", function() {
|
||||
const _this = this;
|
||||
$(this).popover("show");
|
||||
$(".popover").on("mouseleave", function () {
|
||||
|
@ -165,8 +176,10 @@ OperationsWaiter.prototype.opListCreate = function(e) {
|
|||
});
|
||||
}).on("mouseleave", function () {
|
||||
const _this = this;
|
||||
setTimeout(function () {
|
||||
if (!$(".popover:hover").length) {
|
||||
setTimeout(function() {
|
||||
// Determine if the popover associated with this element is being hovered over
|
||||
if ($(_this).data("bs.popover") &&
|
||||
!$(_this).data("bs.popover").$tip.is(":hover")) {
|
||||
$(_this).popover("hide");
|
||||
}
|
||||
}, 50);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue