Skip to content

Commit b8fb549

Browse files
committed
Merge branch 'artemisbot-bug/text-overflow'
2 parents 1435acd + e8e5eb9 commit b8fb549

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

src/web/OperationsWaiter.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,35 @@ OperationsWaiter.prototype.getSelectedOp = function(ops) {
155155
*/
156156
OperationsWaiter.prototype.opListCreate = function(e) {
157157
this.manager.recipe.createSortableSeedList(e.target);
158-
$("[data-toggle=popover]").popover();
158+
this.enableOpsListPopovers(e.target);
159+
};
160+
161+
162+
/**
163+
* Sets up popovers, allowing the popover itself to gain focus which enables scrolling
164+
* and other interactions.
165+
*
166+
* @param {Element} el - The element to start selecting from
167+
*/
168+
OperationsWaiter.prototype.enableOpsListPopovers = function(el) {
169+
$(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]")
170+
.popover({trigger: "manual"})
171+
.on("mouseenter", function() {
172+
const _this = this;
173+
$(this).popover("show");
174+
$(".popover").on("mouseleave", function () {
175+
$(_this).popover("hide");
176+
});
177+
}).on("mouseleave", function () {
178+
const _this = this;
179+
setTimeout(function() {
180+
// Determine if the popover associated with this element is being hovered over
181+
if ($(_this).data("bs.popover") &&
182+
!$(_this).data("bs.popover").$tip.is(":hover")) {
183+
$(_this).popover("hide");
184+
}
185+
}, 50);
186+
});
159187
};
160188

161189

src/web/RecipeWaiter.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ RecipeWaiter.prototype.createSortableSeedList = function(listEl) {
9393
// Removes popover element and event bindings from the dragged operation but not the
9494
// event bindings from the one left in the operations list. Without manually removing
9595
// these bindings, we cannot re-initialise the popover on the stub operation.
96-
$(evt.item).popover("destroy");
96+
$(evt.item).popover("destroy").removeData("bs.popover").off("mouseenter").off("mouseleave");
9797
$(evt.clone).off(".popover").removeData("bs.popover");
9898
evt.item.setAttribute("data-toggle", "popover-disabled");
9999
},
@@ -120,8 +120,7 @@ RecipeWaiter.prototype.opSortEnd = function(evt) {
120120

121121
// Reinitialise the popover on the original element in the ops list because for some reason it
122122
// gets destroyed and recreated.
123-
$(evt.clone).popover();
124-
$(evt.clone).children("[data-toggle=popover]").popover();
123+
this.manager.ops.enableOpsListPopovers(evt.clone);
125124

126125
if (evt.item.parentNode.id !== "rec-list") {
127126
return;

src/web/stylesheets/utils/_overrides.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ optgroup {
142142
border-color: var(--popover-border-colour);
143143
}
144144

145+
.popover-content {
146+
max-height: 90vh;
147+
overflow-y: auto;
148+
}
145149

146150
.popover.right>.arrow {
147151
border-right-color: var(--popover-border-colour);

0 commit comments

Comments
 (0)