[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Correct popover hover interaction and visibility issue

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68ded5b0666fc_2cdf278652ca@gitlab-sidekiq-low-urgency-cpu-bound-v2-58457f7db6-p2cbm.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
b1ecbe33 by Moïse Nturubika at 2025-10-02T19:33:48+00:00
[FIX] Correct popover hover interaction and visibility issue
---
* [FIX] Correct popover hover interaction and visibility issue

See merge request tikiwiki/tiki!7675

- - - - -


1 changed file:

- lib/jquery_tiki/tiki-jquery.js


Changes:

=====================================
lib/jquery_tiki/tiki-jquery.js
=====================================
@@ -526,26 +526,35 @@ $.fn.tiki_popover = function () {
     });
 
     // only have one popover showing at a time
-    $document.on("show.bs.popover", function ( e ) {
-        var event = e;
+    $document.on("show.bs.popover", function (e) {
+        var $currentTrigger = $(e.target);
+
+        // Hide any existing popovers except for the one being triggered
         $('.popover:visible:not(.tour-tour)').each(function () {
-            if (this.previousElementSibling !== event.target) {
-                $(this).popover('hide');
+            var $popover = $(this);
+            var $trigger = $('[aria-describedby="' + $popover.attr('id') + '"]');
+
+            if ($trigger[0] !== $currentTrigger[0]) {
+                $trigger.popover('hide');
             }
         });
     });
 
-    $document.on("hide.bs.popover", function ( e ) {
-        var $popover = $('.popover:visible:not(.tour-tour)');
+    $document.on("hide.bs.popover", function (e) {
+        var $currentTrigger = $(e.target);
+        var $currentPopover = $('#' + $currentTrigger.attr('aria-describedby'));
+        var isHoveringCurrentPopover = $currentPopover.is(':hover');
+        var isHoveringOtherPopover = $('.popover:hover').not($currentPopover).length > 0;
 
-        // if mouse is over the popover
-        if ($popover.find(":hover").length) {
-            // change the leave event to be when leaving the popover
-            $popover.on("mouseleave", function () {
-                $(this).popover("hide");
-            });
-            // and cancel the hide event
+        if (isHoveringCurrentPopover && !isHoveringOtherPopover) {
             e.preventDefault();
+            e.stopPropagation();
+
+            $currentPopover.one('mouseleave', function() {
+                if (!$currentTrigger.is(':hover')) {
+                    $currentTrigger.popover('hide');
+                }
+            });
             return false;
         }
     });



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/b1ecbe33636f0d6c0ce8e4ab27a0044b49c8cf5b

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/b1ecbe33636f0d6c0ce8e4ab27a0044b49c8cf5b
You're receiving this email because of your account on gitlab.com.

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.