diff --git a/js/extkeywidget.js b/js/extkeywidget.js index 69b4677bfb..57960698e9 100644 --- a/js/extkeywidget.js +++ b/js/extkeywidget.js @@ -120,6 +120,7 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper this.sFormAttCode = sFormAttCode; var me = this; + const iDropdownContentHeightDifference = 4; this.Init = function () { // make sure that the form is clean @@ -353,13 +354,13 @@ function ExtKeyWidget(id, sTargetClass, sFilter, sTitle, bSelectMode, oWizHelper // N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar if(oDropdownContentElem) { - oDropdownContentElem.css('max-height', 'calc(30vh - 4px)'); + oDropdownContentElem.css('max-height', `calc(30vh - ${iDropdownContentHeightDifference}px)`); } /* Position dropdown above input if not enough space on the bottom part of the screen Doesn't seem to work with selectize as an internal plugin "auto_position" refreshes the top position after this method is called, input set use a custom plugin to avoid fix this issue "plugin_combodo_auto_position" - This would need to take the potential 4px difference into account if this is fixed. + This would need to take the potential 4px difference (iDropdownContentHeightDifference) into account if this is fixed. */ if ((fDropdownTopY / fWindowHeight) > 0.6) { oDropdownElem.css({ diff --git a/js/selectize/plugin_combodo_auto_position.js b/js/selectize/plugin_combodo_auto_position.js index 129a3a4372..74d073046a 100644 --- a/js/selectize/plugin_combodo_auto_position.js +++ b/js/selectize/plugin_combodo_auto_position.js @@ -19,6 +19,7 @@ Selectize.define("combodo_auto_position", function (aOptions) { // Selectize instance let oSelf = this; + const iDropdownContentHeightDifference = 4; // Plugin options aOptions = $.extend({ @@ -53,7 +54,7 @@ Selectize.define("combodo_auto_position", function (aOptions) { iDropdownHeight = oSelf.$dropdown.outerHeight(); oSelf.$dropdown.css({ - top: oSelf.$control.offset().top - iDropdownHeight + 4, // Content will be shorter, so our real height too + top: oSelf.$control.offset().top - iDropdownHeight + iDropdownContentHeightDifference, // Content will be shorter, so our real height too left: oSelf.$control.offset().left, width: oSelf.$wrapper.outerWidth(), overflowY: 'auto', @@ -62,7 +63,7 @@ Selectize.define("combodo_auto_position", function (aOptions) { // N°9468 Dropdown content needs to be a few pixel shorter than the dropdown itself to avoid double scrollbar oSelf.$dropdown_content.css({ - 'max-height': `calc(${aOptions.maxDropDownHeight} - 4px)` + 'max-height': `calc(${aOptions.maxDropDownHeight} - ${iDropdownContentHeightDifference}px)` }); }