Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: Prevent mobile toolbar jitter when toggling menus https://github.com/siyuan-note/siyuan/issues/19270

Daniel664650760d0b
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index ff86eb381e..6ca96fc060 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -388,7 +388,7 @@ const updateKeyboardToolbarPosition = () => {
};
const getKeyboardViewportBottom = () => !isInMobileApp() && window.visualViewport ?
- window.visualViewport.offsetTop + window.visualViewport.height : window.innerHeight;
+ window.visualViewport.offsetTop + window.visualViewport.height : document.documentElement.getBoundingClientRect().height;
const updateKeyboardPanelHeight = () => {
if (keyboardPanelTop === undefined) {
@@ -400,7 +400,8 @@ const updateKeyboardPanelHeight = () => {
return;
}
const toolbarElement = document.getElementById("keyboardToolbar");
- const barHeight = toolbarElement.querySelector<HTMLElement>(".keyboard__bar").offsetHeight;
+ // 与展开入口保持相同高度口径,避免边框和整数取整导致交接时上下跳动。
+ const barHeight = toolbarElement.querySelector<HTMLElement>(".keyboard__bar").clientHeight;
const height = getKeyboardPanelHeight(getKeyboardViewportBottom(), keyboardPanelTop, barHeight);
if (keyboardPanelClosing && height <= barHeight) {
keyboardPanelClosing = false;