fix(review): 按独立 review(Chromium 实测)修正 #786 的措辞、守卫与覆盖
reviewer 在本机跑 Chromium 逐条实测(同一批宿主规则 + 插件产物),结论:修复方向与形状正确
(`.mermaidModal` 预修复计算 `no-drag`、修复后 `none`;级联探针确实能把未修复产物判红),
但有几处措辞与守卫不到位。逐条处理:
1. **「app-region 会被继承」的说法在该引擎里不成立**:`[data-dsh-panel-host]` 不是 body
子元素(DOM 是 `body > [data-dsh-better-sidebar] > [data-dsh-panel-host]`),lane 用的
Chromium 不传播该属性(实测:`drag` 父元素里子元素读 `none`)。改写成「宿主是 body
子元素;在 Electron 里该值会传到它内部的面板层(#772 的 CDP 实测),lane 的引擎不传播,
所以面板层自己也声明同一条规则」——CSS 注释、指南 §12.1、探针注释三处同步。
2. **`regions.layer` 那条断言是真空断言**(修复前后都读 `none`):保留为回归钉子,但在
注释里明确标注它不具判别力、面板层的规则由 `panel-host-css.spec.ts` 钉住。
3. **给修复本身补行为级守护**:放大视图已经在同一 lane 里被真实打开过,于是在那里直接对
`[data-mermaid-modal]`(以及它的按钮)读计算值——断言用**页面里宿主自己的** darwin
规则(不再是探针复制的副本)。实测判别力:npm 0.22.0 上 `Received: "no-drag"`、修复版
`none`。
4. **「交互层不要加 initial」与放大视图的矛盾**:放大视图是**遮罩层例外**——模态语义下
只有其中控件必须保持 `no-drag`;残余代价(背景落在顶部拖拽带上时点背景会变拖窗)已写进
指南,避免后来者按字面判据「修」掉其中一边。
5. **`.selectionPopup` 的负向守卫可被选择器列表绕过**(reviewer 实测:`.selectionPopup,.x
{ initial !important }` 能通过):改成按**声明块**扫描——凡带 `-webkit-app-region:
initial` 的块,其选择器文本都不得出现 `selectionPopup`。
6. **补上 `none` 关键字的坑**:字面量 `none` 计算成 `no-drag`(是扣减值),只有 `initial`
/`unset`/`revert` 才是中性值——CSS 注释、指南与单元用例注释都已写明。
7. **未覆盖层给出结论**:`FileTree` 的 `.uploadDropChatHint` 是 body 直挂的装饰层,但只在
OS 文件拖拽悬停期间存在且 `pointer-events:none`,收益极小而**有意不处理**(写进指南,
不再让「覆盖清单」看起来是绝对集合)。
8. 顺带:`§12.2` 的同步集里 `tests/theme.spec.ts` 只守颜色(本轮无颜色改动),形状守护落在
已解析该样式表的 `tests/panel-host-css.spec.ts` 上——指南那句已按此表述。
验证:typecheck / lint 通过;panel-host-css 4 例通过;本地挂载 lane 7 passed(含新的放大
视图计算值断言);对 npm 0.22.0 的判别力实测:宿主探针红(`host` = `no-drag`)、放大视图
断言红(`modal` = `no-drag`),修复版全绿。
This commit is contained in:
1 parent
b07c7116c8
commit
e7d2300cf8
4 files changed
+83
-35
No files matched your search
@@ -64,20 +64,28 @@
|
||||
}
|
||||
|
||||
/* Desktop drag regions ignore pointer-events: the shell's base stylesheet
|
||||
makes every direct body child `no-drag`, and this viewport-sized layer
|
||||
inherited it, cancelling every window-drag strip beneath it once the
|
||||
shell recomputed regions (window drags worked once, then stopped).
|
||||
Take the host and layer out of the app-region computation; `!important`
|
||||
because the shell's `body > :not(#root)` selector outranks ours. The
|
||||
panels themselves stay no-drag so their controls keep receiving clicks.
|
||||
The plugin's OTHER viewport-sized body child — the mermaid zoom modal —
|
||||
carries the same reset on its own rule further down, or opening a diagram
|
||||
would blank window drag (and the macOS double-click-title zoom) while it
|
||||
is up. Deliberately NOT applied to the interactive popups (`.selectionPopup`
|
||||
is a `<button>`; FloatingWindow / AnchoredPopover own pointer drags): the
|
||||
shell's `:is(button, a, input, …)` rule already keeps those no-drag, and
|
||||
`initial !important` would outrank it and start a window drag on press
|
||||
instead — the click-swallow regression of issues #103/#111. */
|
||||
makes every direct body child `no-drag`, and the plugin HOST is one — in
|
||||
Electron that value also reaches the viewport-sized panel layer inside it
|
||||
(#772's CDP reading; the browser engine used by the mount lane does not
|
||||
propagate it, so the layer's own rule below is belt-and-braces), which is
|
||||
what cancelled every window-drag strip beneath it once the shell
|
||||
recomputed regions (window drags worked once, then stopped). Take the host
|
||||
and layer out of the app-region computation; `!important` because the
|
||||
shell's `body > :not(#root)` selector outranks ours. The panels themselves
|
||||
stay no-drag so their controls keep receiving clicks.
|
||||
The plugin's OTHER persistent viewport-sized body child — the mermaid zoom
|
||||
modal — carries the same reset on its own rule further down, or opening a
|
||||
diagram would blank window drag (and the macOS double-click-title zoom)
|
||||
while it is up. It is a modal SCRIM, so it does get the reset even though
|
||||
it is interactive: only its widgets (`<button>` …) need to stay no-drag,
|
||||
and the residual is that its backdrop inside the shell's top drag band
|
||||
starts a window drag instead of closing the modal — the deliberate trade
|
||||
for keeping the window draggable while a diagram is enlarged.
|
||||
Deliberately NOT applied to the other interactive popups (`.selectionPopup`
|
||||
is a `<button>`; FloatingWindow / AnchoredPopover own pointer drags and are
|
||||
not scrims): the shell's `:is(button, a, input, …)` rule already keeps those
|
||||
no-drag, and `initial !important` would outrank it and start a window drag on
|
||||
press instead — the click-swallow regression of issues #103/#111. */
|
||||
:global(html[data-platform] body > [data-dsh-better-sidebar]),
|
||||
:global([data-dsh-panel-host]) {
|
||||
-webkit-app-region: initial !important;
|
||||
|
||||
Reference in new issue
Block a user