diff options
author | Jo-Philipp Wich <jo@mein.io> | 2021-12-09 15:28:39 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2021-12-09 15:29:36 +0100 |
commit | 604c00905987cf38336754aef408d837b368a8e5 (patch) | |
tree | 49db2fec8f0e214dffea3dfd1859de55be9fd263 | |
parent | 5cdfbf37ea73aa07e9e9d38308c7e9e21764a5ca (diff) |
luci-base: ui.js: avoid error tooltips overlapping dropdowns
Fixes: #5588
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 9f3e74b935..ac158f5260 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -3250,7 +3250,8 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ { var rect = target.getBoundingClientRect(), x = rect.left + window.pageXOffset, - y = rect.top + rect.height + window.pageYOffset; + y = rect.top + rect.height + window.pageYOffset, + above = false; tooltipDiv.className = 'cbi-tooltip'; tooltipDiv.innerHTML = '▲ '; @@ -3259,7 +3260,15 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ { if (target.hasAttribute('data-tooltip-style')) tooltipDiv.classList.add(target.getAttribute('data-tooltip-style')); - if ((y + tooltipDiv.offsetHeight) > (window.innerHeight + window.pageYOffset)) { + if ((y + tooltipDiv.offsetHeight) > (window.innerHeight + window.pageYOffset)) + above = true; + + var dropdown = target.querySelector('ul.dropdown[style]:first-child'); + + if (dropdown && dropdown.style.top) + above = true; + + if (above) { y -= (tooltipDiv.offsetHeight + target.offsetHeight); tooltipDiv.firstChild.data = '▼ ' + tooltipDiv.firstChild.data.substr(2); } |