修复移动端软键盘页面弹跳黑底
移除 H5 软键盘打开时平台壳全局 transform 位移,避免浏览器原生避让后再次弹跳。 保留键盘打开状态、底部 dock 隐藏和浅色根背景兜底,避免短表单露出黑色宿主底色。 补充小程序 web-view 原生 page 浅色背景和对应样式测试。 更新统一创作页与平台键盘适配文档,沉淀不再全局上移平台壳的约束。
This commit is contained in:
32
miniprogram/pages/web-view/index.style.test.js
Normal file
32
miniprogram/pages/web-view/index.style.test.js
Normal file
@@ -0,0 +1,32 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
const PAGE_DIR = path.resolve(
|
||||
process.cwd(),
|
||||
'miniprogram/pages/web-view',
|
||||
);
|
||||
|
||||
function readPageFile(fileName) {
|
||||
return fs.readFileSync(path.join(PAGE_DIR, fileName), 'utf8');
|
||||
}
|
||||
|
||||
describe('mini program web-view page background', () => {
|
||||
test('keeps the native web-view host light when the mobile keyboard exposes it', () => {
|
||||
const wxml = readPageFile('index.wxml');
|
||||
const wxss = readPageFile('index.wxss');
|
||||
|
||||
expect(wxml).toContain('class="web-view-host"');
|
||||
expect(wxml).not.toContain('class="web-view-page"');
|
||||
expect(wxss).toContain('page');
|
||||
expect(wxss).toContain('.web-view-host');
|
||||
expect(wxss).toContain('background: #fffdf9;');
|
||||
|
||||
const webViewHostBlock = wxss.slice(
|
||||
wxss.indexOf('.web-view-host'),
|
||||
wxss.indexOf('.setup-screen'),
|
||||
);
|
||||
expect(webViewHostBlock).not.toContain('#0b0f14');
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,7 @@
|
||||
<block wx:if="{{webViewUrl}}">
|
||||
<web-view
|
||||
id="genarrative-web-view"
|
||||
class="web-view-host"
|
||||
src="{{webViewUrl}}"
|
||||
bindload="handleWebViewLoad"
|
||||
binderror="handleWebViewError"
|
||||
|
||||
@@ -1,3 +1,14 @@
|
||||
page {
|
||||
background: #fffdf9;
|
||||
}
|
||||
|
||||
.web-view-host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 100vh;
|
||||
background: #fffdf9;
|
||||
}
|
||||
|
||||
.setup-screen {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user