docs(runtime): correct box.vue $el comment (fragment anchor, subtree-drilled)

Reviewer caught a stale comment: it claimed the root-`v-if` fragment's `$el`
"resolves to the real host node". It doesn't — `$el` is the fragment boundary
anchor; measureElement/useBoxMetrics resolve a Box ref by drilling the component
subTree to its first host node. Also fixed a leftover `box.ts` reference
(now box-validate.ts). Comment-only; code was correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yunfei He
2026-06-14 15:35:08 +08:00
parent 3a029aa684
commit 33da2e5073
+5 -4
View File
@@ -18,10 +18,11 @@ const srHidden = computed(() => srEnabled.value && props.ariaHidden);
<template>
<!-- assertBoxValid runs every render and throws into the error boundary, exactly
as the former render fn did; `!srHidden &&` short-circuits validation when the
Box is screen-reader-hidden (mirrors box.ts ordering: a non-emitted node never
colorizes). Under a screen reader with an ariaLabel, render the label text
instead of the slot. The root `v-if` makes this a fragment, but $el still
resolves to the real `tui-box` host node, so measureElement/useBoxMetrics work. -->
Box is screen-reader-hidden (mirrors box-validate.ts ordering: a non-emitted node
never colorizes). Under a screen reader with an ariaLabel, render the label text
instead of the slot. The root `v-if` makes this component a Vue Fragment, so its
`$el` is the fragment's boundary anchor — NOT the `tui-box` host node; a Box ref is
resolved to its host node by drilling the component subTree (see useBoxMetrics). -->
<tui-box v-if="!srHidden && assertBoxValid(props)" v-bind="props">
<tui-text v-if="srEnabled && props.ariaLabel">{{ props.ariaLabel }}</tui-text>
<slot v-else />