Skip to content

fix(components): drop slider hit zIndex that outranked host overlays - #96

Merged
sudoevolve merged 1 commit into
sudoevolve:devfrom
Linductor-alkaid:fix/slider-hit-zindex-subtree-order
Oct 10, 2026
Merged

sudoevolve merged 1 commit into
sudoevolve:devfrom
Linductor-alkaid:fix/slider-hit-zindex-subtree-order

Conversation

@Linductor-alkaid

Copy link
Copy Markdown
Contributor

Closes #95。

修改内容

移除 components/slider.h 内部热区 .hit 的 .zIndex(10),并新增回归测试 tests/unit/slider_subtree_z_order.cpp。

修改原因

命中测试与绘制遍历按 subtreeMaxZIndex 排序(dsl.h 的 rebuildOrderedElements,升序、命中逆序)。.hit 的栈内输入优先级本就由合成序保证(栈内最后一个子元素最先被逆序命中),zIndex(10) 没有栈内收益,却把任何包含滑条的页面子树排序键抬到 10:宿主在页面之后合成的默认 z=0 根级浮层(scrim、下拉菜单)在排序中落到页面之下,命中与绘制双双失效——真实宿主(节点编辑器画布,浮层下拉 + 滑条参数节点)真机 A/B 实证:含滑条时点击浮层菜单项的坐标事件穿透到页面输入区,不含滑条则正常。详见 #95。

实际执行的测试

  • cmake --build build-fix -j(Debug,-DEUI_BUILD_TEST_FIXTURES=ON):全目标零错误;
  • ctest:34/34 通过(含新增 slider_subtree_z_order;修复前该测试在首条断言失败:slider inflates page subtreeMaxIndex to 10,语义即回归判定);
  • 宿主端到端 A/B:移除该 zIndex 后,原穿透场景(滑条节点页面 + 根级下拉浮层点击)恢复正常命中。

影响范围

仅滑条内部热区的 z 声明;栈内行为不变(track/fill/knob/hit 的命中与绘制序均保持原有效结果)。结构性使用 zIndex 的组件(如 carousel 的景深卡片)不在此列,未改动。

The slider's internal ".hit" area carried zIndex(10). Hit testing and
painting traverse ordered children sorted by subtreeMaxZIndex
(dsl.h rebuildOrderedElements), so any page containing a slider had its
subtree sort key raised to 10: root-level overlays composed later at the
default z=0 (scrim, dropdown menus) were sorted below the page and lost
both hit priority and paint order - clicks fell through to the page
underneath.

The hit area keeps its input priority via composition order (last child
of the slider stack is hit-tested first in reversed order), so the
zIndex is unnecessary. Drop it and add a regression test asserting the
page subtree stays at z=0, the overlay keeps its compose position, and
the hit area remains the topmost ordered child of the slider stack.

Reproduced end-to-end in a host app (node editor with sliders and
root-level dropdown overlays): with the old zIndex, clicks on the
dropdown scrim/items landed on the canvas input area; without it,
overlays receive clicks as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants