Fix help icon overlay viewport handling on mobile
This commit is contained in:
@@ -428,7 +428,8 @@
|
||||
|
||||
document.querySelectorAll('.sg-help-icon-wrap').forEach((wrap) => {
|
||||
const button = wrap.querySelector('.sg-help-icon');
|
||||
if (!button) {
|
||||
const panel = wrap.querySelector('.sg-help-icon-panel');
|
||||
if (!button || !panel) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -449,8 +450,23 @@
|
||||
menuButton.setAttribute('aria-expanded', 'false');
|
||||
}
|
||||
});
|
||||
wrap.dataset.align = 'left';
|
||||
wrap.dataset.open = String(nextState);
|
||||
button.setAttribute('aria-expanded', String(nextState));
|
||||
|
||||
if (!nextState) {
|
||||
return;
|
||||
}
|
||||
|
||||
const panelRect = panel.getBoundingClientRect();
|
||||
if (panelRect.right > window.innerWidth) {
|
||||
wrap.dataset.align = 'right';
|
||||
}
|
||||
|
||||
const alignedPanelRect = panel.getBoundingClientRect();
|
||||
if (alignedPanelRect.left < 0) {
|
||||
wrap.dataset.align = 'left';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user