fix(mobile): 修复键盘视口与输入缩放并优化删除交互

- 同步 Safari 可视高度和偏移,限制聊天页面滚动并保留手动缩放
- 统一移动输入字号并限制消息输入框高度
- 分离滑动删除按钮,将确认和选择弹窗改为居中样式
This commit is contained in:
湛兮
2026-10-28 16:08:15 +08:00
parent ebb8a50eb6
commit caa54c9b34
4 changed files with 104 additions and 33 deletions
+51 -21
View File
@@ -636,9 +636,9 @@
/* 横滑只移动会话卡片,删除在明确确认后才执行。 */
.dh-conversation-row {
position: relative;
overflow: hidden;
overflow: visible;
border-radius: 14px;
background: #9a394b;
background: transparent;
}
.dh-conversation-list .dh-conversation-open {
position: relative;
@@ -659,9 +659,11 @@
gap: 5px;
align-items: center;
justify-content: center;
width: 88px;
width: 76px;
color: #fff;
background: #9a394b;
background: #a3374c;
border-radius: 14px;
box-shadow: 0 4px 16px #0003;
visibility: hidden;
}
.dh-conversation-row.is-revealed .dh-row-delete-swipe {
@@ -699,7 +701,11 @@
}
.dh-delete-dialog {
width: min(420px, calc(100% - 32px));
max-height: 90dvh;
max-height: calc(100dvh - 48px);
margin: auto;
overflow-y: auto;
overscroll-behavior: contain;
box-shadow: 0 24px 80px #0008;
padding: 26px;
color: var(--dh-text);
background: var(--dh-panel);
@@ -882,12 +888,10 @@
font-size: 10px;
}
.dh-delete-dialog {
width: 100%;
max-width: 100%;
margin: auto 0 0;
padding: 24px 22px calc(22px + env(safe-area-inset-bottom));
border-radius: 22px 22px 0 0;
border-bottom: 0;
width: min(380px, calc(100% - 40px));
margin: auto;
padding: 24px;
border-radius: 22px;
}
.dh-app .dh-compose-tools .dh-mobile-linebreak {
display: flex;
@@ -1313,7 +1317,7 @@
min-height: 76px;
}
}
/* H5 选择项以底部抽屉编辑草稿,确认后才回填到对话设定。 */
/* H5 选择项在居中弹窗编辑草稿,确认后才回填到对话设定。 */
.dh-mobile-choices {
display: none;
}
@@ -1328,8 +1332,9 @@
inset: 0;
z-index: 2;
display: flex;
align-items: flex-end;
align-items: center;
justify-content: center;
padding: 20px;
overscroll-behavior: contain;
}
.dh-selection-backdrop {
@@ -1343,15 +1348,14 @@
position: relative;
display: flex;
flex-direction: column;
width: 100%;
width: min(520px, 100%);
max-height: 86dvh;
min-height: 0;
overflow: hidden;
background: var(--dh-panel);
border: 1px solid #ffffff1c;
border-bottom: 0;
border-radius: 24px 24px 0 0;
box-shadow: 0 -16px 60px #0005;
border-radius: 22px;
box-shadow: 0 24px 80px #0008;
animation: dh-sheet-enter 180ms ease-out;
}
.dh-sheet-handle {
@@ -1442,10 +1446,12 @@
}
@keyframes dh-sheet-enter {
from {
transform: translateY(100%);
opacity: 0;
transform: translateY(8px) scale(0.98);
}
to {
transform: translateY(0);
opacity: 1;
transform: translateY(0) scale(1);
}
}
@media (width > 600px) {
@@ -1833,7 +1839,7 @@
width: 100%;
resize: none;
min-height: 36px;
max-height: 160px;
max-height: min(160px, calc(var(--dh-viewport, 100dvh) * 0.28));
border: 0;
background: none;
padding: 7px 0;
@@ -2228,7 +2234,7 @@
}
.dh-chat {
position: fixed;
inset: 0;
inset: var(--dh-viewport-top, 0px) 0 auto;
width: 100%;
height: var(--dh-viewport, 100dvh);
z-index: 20;
@@ -2392,3 +2398,27 @@ body:has(.dh-app) .environment-badge {
width: 16px;
height: 16px;
}
/* 聊天独立占据可视区域,防止焦点滚动带动整个文档。 */
html.dh-chat-active,
html.dh-chat-active body {
overflow: hidden;
overscroll-behavior: none;
}
.dh-composer-wrap {
flex-shrink: 0;
}
@media (pointer: coarse) {
/* iOS 会自动放大不足 16px 的表单;覆盖各页面局部小字号,同时保留手动缩放。 */
.dh-app input:not([type="checkbox"]):not([type="radio"]),
.dh-app textarea,
.dh-app select {
font-size: 16px;
}
.dh-conversation-list .dh-conversation-open {
overflow: hidden;
}
.dh-conversation-list .dh-row-delete-desktop {
display: none;
}
}