luci-base: ui.js: avoid error tooltips overlapping dropdowns
Fixes: #5588 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
5cdfbf37ea
commit
604c009059
1 changed files with 11 additions and 2 deletions
|
@ -3250,7 +3250,8 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
|
||||||
|
|
||||||
var rect = target.getBoundingClientRect(),
|
var rect = target.getBoundingClientRect(),
|
||||||
x = rect.left + window.pageXOffset,
|
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.className = 'cbi-tooltip';
|
||||||
tooltipDiv.innerHTML = '▲ ';
|
tooltipDiv.innerHTML = '▲ ';
|
||||||
|
@ -3259,7 +3260,15 @@ var UI = baseclass.extend(/** @lends LuCI.ui.prototype */ {
|
||||||
if (target.hasAttribute('data-tooltip-style'))
|
if (target.hasAttribute('data-tooltip-style'))
|
||||||
tooltipDiv.classList.add(target.getAttribute('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);
|
y -= (tooltipDiv.offsetHeight + target.offsetHeight);
|
||||||
tooltipDiv.firstChild.data = '▼ ' + tooltipDiv.firstChild.data.substr(2);
|
tooltipDiv.firstChild.data = '▼ ' + tooltipDiv.firstChild.data.substr(2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue