[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Admin dropdown menu being cut off near viewport bottom
Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6993583ce0543_3b1863d45285f@gitlab-sidekiq-low-urgency-cpu-bound-v2-6547747b55-n46c2.mail> |
Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
Commits:
01ae0532 by Yves Ngalamulume at 2026-02-16T17:39:35+00:00
[FIX] Admin dropdown menu being cut off near viewport bottom
---
* Fix dropdown orientation logic and formatting
* Fix dropdown orientation for mod-menubottom modules
* Fix dropdown orientation for mod-menubottom modules
* Add comment explaining dropdown max-height value
* [FIX] Admin dropdown menu being cut off near viewport bottom
See merge request tikiwiki/tiki!9489
- - - - -
1 changed file:
- src/js/jquery-tiki/tiki-menu.js
Changes:
=====================================
src/js/jquery-tiki/tiki-menu.js
=====================================
@@ -6,40 +6,27 @@
* meant only for global function and structure definitions.
*
* Dependencies: jQuery
+ * Determine dropdown orientation based on module position
+ * instead of viewport-based heuristics.
+ *
+ * This avoids unreliable layout assumptions and ensures
+ * consistent behavior across themes and screen sizes.
*/
$(function () {
$(".sm-nav-item, .dropdown, .mega-menu").each(function () {
- const rect = this.getBoundingClientRect();
- const position = rect.top < window.innerHeight / 2 ? "top" : "bottom";
+ const $parent = $(this);
+ const $menu = $parent.find(".dropdown-menu, ul").first();
+ if (!$menu.length) return;
- let $dropdown = $(this).find(".dropdown-menu");
- if ($dropdown.length === 0) {
- $dropdown = $(this).find("ul");
- }
+ const id = $parent.closest(".card-body").attr("id");
- if ($dropdown.length > 0) {
- if (position !== "bottom") {
- $dropdown.removeClass("dropdown-menu-bottom");
- } else {
- $dropdown.addClass("dropdown-menu-bottom");
- }
+ if (id && id.startsWith("mod-menubottom")) {
+ $menu.addClass("dropdown-menu-bottom");
+ } else {
+ $menu.addClass("dropdown-menu-top-t");
}
});
-
- // Position submenu dropdowns appropriately when expanded
- $(document).on("shown.bs.collapse", ".sm-sub", function () {
- const $menu = $(this);
- const $toggler = $menu.prev(".sm-sub-toggler");
- if ($toggler.length === 0) return;
-
- const rect = $toggler[0].getBoundingClientRect();
- const vertical = rect.top < window.innerHeight / 2 ? "top-t" : "bottom-b";
- const horizontal = rect.left < window.innerWidth / 2 ? "end-l" : "start-r";
-
- $menu.removeClass("dropdown-menu-top-t dropdown-menu-bottom-b dropdown-menu-end-l dropdown-menu-start-r");
- $menu.addClass(`dropdown-menu-${vertical} dropdown-menu-${horizontal}`);
- });
});
/* Mobile dropdown positioning */
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/01ae0532024c0690f1eea6fd3745fa4ece21f5e5
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/01ae0532024c0690f1eea6fd3745fa4ece21f5e5
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