Repository navigation
Fix #28: let the mobile backdrop cover the topbar too - #38
Open
xiaoyao-666-coder wants to merge 2 commits into
Open
xiaoyao-666-coder wants to merge 2 commits into
xiaoyao-666-coder wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
抽屉打开时顶栏 inert 但看似可点——不过核实后发现 issue 描述有三处与代码不符(以代码为准):
App.tsx:907在mobilePanel打开时已渲染<button className="mobile-panel-backdrop" onClick={closeMobilePanel}>,不是 issue 说的“零命中”。.topbar和.chat-workspace加inert,关闭时移除。键盘焦点进不去顶栏,inert在现代浏览器里也让顶栏按钮不再是点按目标。--header-h: 56px这个变量,抽屉top:72px/64px与顶栏 64px/58px 之间的几 px 间距是刻意的留白,不是 bug,没动。真正的问题是遮罩的几何:
styles.css里inset:64px 0 0(≤560px 时inset:58px 0 0),遮罩从顶栏下方才开始,顶栏那 64px/58px 的条带没有被盖住。所以“假死感”的准确描述是:顶栏看起来完全正常、可点(未被遮罩压暗),但点上去什么都不发生(inert 拦住了点击,遮罩又没盖住它所以也不会关抽屉)。修复
只改遮罩的覆盖范围,不动 inert 与焦点逻辑。选了“点击顶栏区域能关掉抽屉”这条验收路径(而不是给顶栏加变灰样式),因为遮罩本来就存在、且点遮罩关闭抽屉是用户已有的心智模型,改动最小:
frontend/src/styles.css(≤1020px 块):.mobile-panel-backdrop的inset:64px 0 0改为inset:0,并附注释说明原因;删除 ≤560px 块里.mobile-panel-backdrop { inset:58px 0 0; }的覆盖。position:fixed; z-index:4会盖住它并压暗(#14202b33),视觉上也明确表示“不可点”;两个抽屉position:fixed; z-index:5仍在遮罩之上,照常可交互;toast(z-index:10)不受影响。遮罩的display:block只在 ≤1020px 媒体查询内,桌面端无任何变化;切换到桌面宽度时原有监听器会关闭抽屉,修法只影响小屏。App.tsx未动:已有的 inert(键盘防护)与抽屉内焦点陷阱、Esc 关闭、恢复焦点逻辑全部保留。验证
npm test15 pass / 0 fail(基线 10 + 新增 5),npm run build(tsc -b && vite build)正常。新增测试覆盖:遮罩覆盖整个视口(含顶栏条带、无 64px/58px 残留)、遮罩只在移动端布局出现、抽屉 z-index 5 高于遮罩 z-index 4、抽屉打开时渲染遮罩按钮且点按关闭、顶栏 inert 逻辑未被破坏。MEDGUIDE_MODE=test python -m pytest -q backend/tests521 passed(基线,无后端改动)。已知遗留
Closes #28