[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX][UI] Modals: allow resizable modals to adapt to growing content while...

"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6996f71c2b4e9_3b186b5425683@gitlab-sidekiq-low-urgency-cpu-bound-v2-cb6cf494-slzpm.mail>

MAGENE Sem Joel pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
036095fc by MAGENE Sem Joel at 2026-02-19T11:34:40+00:00
[BP][FIX][UI] Modals: allow resizable modals to adapt to growing content while...
---
* [FIX][UI] Modals: allow resizable modals to adapt to growing content while...
---
* [FIX][UI] Modals: allow resizable modals to adapt to growing content while preventing dropdown clipping

See merge request tikiwiki/tiki!9524

(cherry picked from commit 0404d05d2b2eb1aa9d68d24df35e0da858e2dcd0)

See merge request tikiwiki/tiki!9609

- - - - -


1 changed file:

- lib/setup/javascript.php


Changes:

=====================================
lib/setup/javascript.php
=====================================
@@ -354,7 +354,7 @@ $(document).on("tiki.modal.redraw", function(event) {
         $modalContent = $modalContent.find(".modal-content")
     }
     
-    // Guard (prevents duplicate listeners)
+    // Guard: Prevent duplicate listeners on the same modal
     const el = $modalContent[0];
     if (el.dataset.resizeInit === '1') return;
     el.dataset.resizeInit = '1';
@@ -362,7 +362,7 @@ $(document).on("tiki.modal.redraw", function(event) {
     const modalBody = $modalContent.find(".modal-body")[0];
     if (!modalBody) return;
 
-    let initialWidth, initialHeight;
+    let initialHeight;
     const initialOverflow = getComputedStyle(modalBody).overflow;
 
     const modalId = 'modal' + Math.random().toString(36).substring(7);
@@ -374,10 +374,9 @@ $(document).on("tiki.modal.redraw", function(event) {
         edges: { left: true, right: true, bottom: true, top: true },
         inertia: true,
         listeners: {
-            // The start listener captures the modal's dimensions at the moment resizing begins, which is crucial for the overflow logic to work correctly on the first try.
+            // The start listener captures the modal's initial height if not yet done, at the moment resizing begins.
             start(event) {
-                initialWidth = event.rect.width;
-                initialHeight = event.rect.height;
+                if(! initialHeight) initialHeight = event.rect.height;
             },
             move: (e) => {
                 const target = e.target;
@@ -390,12 +389,13 @@ $(document).on("tiki.modal.redraw", function(event) {
                 const y = (parseFloat(target.dataset.y) || 0) + (e.deltaRect.top || 0);
 
                 target.style.width = `${width}px`;
-                target.style.height = `${height}px`;
+                if (e.edges.top || e.edges.bottom) {
+                    target.style.height = `${height}px`;
+                }
                 target.style.transform = `translate(${x}px, ${y}px)`;
                 target.dataset.x = x;
                 target.dataset.y = y;
-
-                if (width < initialWidth || height < initialHeight) {
+                if (width < modalBody.scrollWidth || height < initialHeight) {
                     modalBody.style.overflow = "auto";
                 } else {
                     modalBody.style.overflow = initialOverflow;



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/036095fc6d881f4dcef5e93824ef34e99e58c255
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.