fix(mobile): 手机PopupWindow点输入域弹窗即关——.popupwindow移动端position:fixed钉死视口(主修:软键盘收缩视口后focus自动滚动把absolute弹窗滚出可视区)+focusin滚动归零安全网+_mobile_clamp重钳归零

This commit is contained in:
yumoqing 2026-09-16 12:18:55 +08:00
parent 449631732a
commit 7c1661312e
2 changed files with 24 additions and 0 deletions

View File

@ -1215,6 +1215,11 @@ hr {
top: 0 !important; top: 0 !important;
border-radius: 0 !important; border-radius: 0 !important;
box-sizing: border-box; box-sizing: border-box;
/* 2026-09-16 用户报障「手机待办详情点输入域弹窗即关」根因修复:
* .popup 基类是 position:absolute——软键盘弹出收缩视口后文档可滚,
* 浏览器 focus 自动滚动把 absolute 弹窗整块滚出可视区(视觉=弹窗没了),
* 部分内嵌浏览器 resize/clamp 补偿不来。fixed 钉死视口,文档怎么滚都不动。 */
position: fixed !important;
} }
/* 普通弹出控件(.popup:下拉/提示/锚定小窗)不许高出可视屏。 /* 普通弹出控件(.popup:下拉/提示/锚定小窗)不许高出可视屏。
* :not(.popupwindow) —— PopupWindow 同时带两个类,它的高度由上面 * :not(.popupwindow) —— PopupWindow 同时带两个类,它的高度由上面

View File

@ -55,6 +55,20 @@ bricks.Popup = class extends bricks.VBox {
if (this.auto_dismiss){ if (this.auto_dismiss){
bricks.Body.bind('click', this.click_outside.bind(this)); bricks.Body.bind('click', this.click_outside.bind(this));
} }
// 2026-09-16 手机「点输入域弹窗即关」根因修复(安全网,CSS fixed 为主修):
// 软键盘弹出收缩视口后文档变可滚,浏览器 focus 自动滚动会把 absolute
// 弹窗整块滚出可视区(视觉=弹窗没了/键盘瞬关)。focusin 时若顶层
// PopupWindow 开着,立即把文档滚动归零。全局只装一次。
if (!bricks.Popup._focus_scroll_guard){
bricks.Popup._focus_scroll_guard = true;
document.addEventListener('focusin', function(){
if (!bricks.is_mobile || !bricks.is_mobile()) return;
var top = bricks.app.toppopup;
if (top && top.opened && top instanceof bricks.PopupWindow && window.scrollY){
window.scrollTo(0, 0);
}
}, true);
}
this.target_w = bricks.Body; this.target_w = bricks.Body;
this.moving_status = false; this.moving_status = false;
if (this.movable){ if (this.movable){
@ -331,6 +345,11 @@ bricks.Popup = class extends bricks.VBox {
el.style.setProperty('max-height', maxh + 'px', 'important'); el.style.setProperty('max-height', maxh + 'px', 'important');
this._mobile_clamped = true; this._mobile_clamped = true;
} }
// 2026-09-16:全屏弹窗重钳时把文档滚动归零——软键盘收缩视口后浏览器
// focus 自动滚动可能已把 absolute 弹窗滚出可视区(点输入域"弹窗即关")。
if (is_win && window.scrollY){
window.scrollTo(0, 0);
}
if (el.offsetWidth > vw){ if (el.offsetWidth > vw){
el.style.setProperty('width', vw + 'px', 'important'); el.style.setProperty('width', vw + 'px', 'important');
el.style.setProperty('max-width', vw + 'px', 'important'); el.style.setProperty('max-width', vw + 'px', 'important');