Restore non-wrapping mobile tabs and clamp help tooltip in viewport

This commit is contained in:
2026-05-26 08:56:54 +02:00
parent 33921a3f6e
commit b34ceda1e3
2 changed files with 22 additions and 10 deletions
@@ -453,6 +453,7 @@
wrap.dataset.align = 'left';
wrap.dataset.open = String(nextState);
button.setAttribute('aria-expanded', String(nextState));
panel.style.removeProperty('transform');
if (!nextState) {
return;
@@ -471,6 +472,20 @@
if (alignedPanelRect.left < 0) {
wrap.dataset.align = 'left';
}
const clampedRect = panel.getBoundingClientRect();
const safeInset = 8;
let shiftX = 0;
if (clampedRect.right > (viewportWidth - safeInset)) {
shiftX -= clampedRect.right - (viewportWidth - safeInset);
}
if ((clampedRect.left + shiftX) < safeInset) {
shiftX += safeInset - (clampedRect.left + shiftX);
}
if (shiftX !== 0) {
panel.style.transform = `translateX(${shiftX}px)`;
}
});
});
@@ -488,7 +503,11 @@
if (!event.target.closest('.sg-help-icon-wrap')) {
document.querySelectorAll('.sg-help-icon-wrap').forEach((wrap) => {
const button = wrap.querySelector('.sg-help-icon');
const panel = wrap.querySelector('.sg-help-icon-panel');
wrap.dataset.open = 'false';
if (panel) {
panel.style.removeProperty('transform');
}
if (button) {
button.setAttribute('aria-expanded', 'false');
}