diff options
Diffstat (limited to 'web_src/js')
-rw-r--r-- | web_src/js/features/common-global.js | 9 | ||||
-rw-r--r-- | web_src/js/modules/fomantic.js | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 96fa8a7dd2..89e277ac84 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -111,8 +111,15 @@ export function initGlobalCommon() { }, }); - // special popup-directions + // Special popup-directions, prevent Fomantic from guessing the popup direction. + // With default "direction: auto", if the viewport height is small, Fomantic would show the popup upward, + // if the dropdown is at the beginning of the page, then the top part would be clipped by the window view. + // eg: Issue List "Sort" dropdown + // But we can not set "direction: downward" for all dropdowns, because there is a bug in dropdown menu positioning when calculating the "left" position, + // which would make some dropdown popups slightly shift out of the right viewport edge in some cases. + // eg: the "Create New Repo" menu on the navbar. $uiDropdowns.filter('.upward').dropdown('setting', 'direction', 'upward'); + $uiDropdowns.filter('.downward').dropdown('setting', 'direction', 'downward'); $('.ui.checkbox').checkbox(); diff --git a/web_src/js/modules/fomantic.js b/web_src/js/modules/fomantic.js index 218166249f..2109ff1726 100644 --- a/web_src/js/modules/fomantic.js +++ b/web_src/js/modules/fomantic.js @@ -9,10 +9,6 @@ export function initGiteaFomantic() { // Disable the behavior of fomantic to toggle the checkbox when you press enter on a checkbox element. $.fn.checkbox.settings.enableEnterKey = false; - // Prevent Fomantic from guessing the popup direction. - // Otherwise, if the viewport height is small, Fomantic would show the popup upward, - // if the dropdown is at the beginning of the page, then the top part would be clipped by the window view, eg: Issue List "Sort" dropdown - $.fn.dropdown.settings.direction = 'downward'; // By default, use "exact match" for full text search $.fn.dropdown.settings.fullTextSearch = 'exact'; // Do not use "cursor: pointer" for dropdown labels |