Repository navigation
Commit aef42cb
fix(app-shell): the phone bar lights More when the page in view lives behind it (#35130)
Fixes #35020
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
**改了什么**:手机端底部菜单栏:当前页面的菜单项不在底部四项里、但在「更多」打开的完整菜单里时,「更多」高亮;在四项里时照旧高亮那一项,「更多」不高亮。「更多」打开后当前项的选中态,实测在
main 上本来就有,本 PR 只加测试钉住,没有改抽屉。
- **为什么改**:在「商机」这类不在底部四项里的页面,底部五项都不亮,用户看不出自己在哪个菜单(卡上 375×812 实测)。
- **风险与回滚**:只改 `PhoneAppNavBar.tsx` 里「更多」的高亮判定(20 行增、5
行删),不改底部四项的取法,不改元数据、接口或导出。没有任何菜单项对应的页面不亮任何一项(「更多」亮着就承诺点开后有选中的那一行)。回滚即还原本
PR。
- **先看**:`ui/packages/app-shell/src/layout/PhoneAppNavBar.tsx` 的
`currentBehindMore` 判定和「更多」按钮上的
`aria-current`;`ui/packages/app-shell/src/layout/__tests__/UnifiedSidebar.phoneNavBar-34594.test.tsx`
新增的 describe。
- **两分钟验证**:`pnpm --dir ui exec vitest run
packages/app-shell/src/layout/__tests__/UnifiedSidebar.phoneNavBar-34594.test.tsx`,预期
16 个用例全绿;或在 375 宽打开 HotCRM
销售应用(不固定任何菜单项)的「商机」列表,底部「更多」高亮,点开后「商机」一行是选中态;切到「线索」列表,亮的是「线索」,「更多」不亮。
- **需要你做的**:无,席位落地。
## What changes
- `PhoneAppNavBar` still elects the page's row the way the drawer does
(`resolveActiveNavItem` over the whole tree) and still lights an entry
cell only when that row is the cell's entry. New: when the elected row
is drawn in the full menu (`drawnNavigationEntries` under the sidebar's
own guards) but holds no bar cell, 「More」 takes the lit look
(`text-primary`) and `aria-current="true"`. At most one cell is ever
lit.
- A page that elects no row, or elects a row the menu does not draw (a
`visible: false` entry reached by URL), lights no cell, More included:
More lit says the menu behind it has the page's row selected, and there
would be none.
- While the full menu is open, More stays lit for the open menu and no
cell carries `aria-current` (unchanged for entry cells; More follows the
same rule).
- **`aria-current="true"`, not `"page"`, on More:** the cell is a button
that opens the menu holding the page's row, not a link to the page;
`"page"` would announce the button itself as the current page. ARIA's
`true` token is "the current item within a set" when no specific token
fits. The entry cells keep `aria-current="page"`: they are links to the
page.
- **Item 2 of the card (the opened menu selects the current row) was
already met on `958ee035`**, measured before any code change (see
Verification): the drawer's `NavigationRenderer` elects the same row,
draws `data-active="true"` on it, and opens the group holding it. No
drawer change; the pins hold it.
- **Public surface:** no prop added. `PhoneAppNavBar` is not re-exported
by `ui/packages/app-shell/src/layout/index.ts`, so the package entry
does not carry it; the claim's `Clause-②: no` holds by that reading.
- Changeset `.changeset/35020-phone-bar-more-active.md`,
`@object-ui/app-shell: patch` (the precedent the other app-shell fixes
this week follow).
## Tests
A new top-level `describe` in the existing shared harness
`UnifiedSidebar.phoneNavBar-34594.test.tsx`, not a new file: AGENTS.md's
test discipline sends a new pin for a component that already has a
shared harness file into that file (ruling record 6583487846). The
harness renders the real `UnifiedSidebar`, `SidebarProvider` and
`@object-ui/layout` at 375 px.
- Acceptance line 1, two setups: pins put Opportunities off the bar (the
card's 「商机」 shape), and nothing pinned with My tasks as the fifth entry
(the card's "用户没有固定任何菜单项"). Each asserts the lit cells are exactly More,
More carries `aria-current="true"`, no entry carries
`aria-current="page"`; then opens More and asserts the menu's selected
rows are exactly that row, More is `aria-expanded` and still the one lit
cell.
- Acceptance line 2: on the Leads page the lit cells are exactly Leads
(with `aria-current="page"`), More carries no `aria-current`; opened,
More is the one lit cell and the menu selects Leads.
- CONTROL, two rows: a page whose elected row the menu does not draw,
and a page no entry addresses, light no cell and carry no
`aria-current`.
## Acceptance notes
- The card's reader names
`ui/packages/layout/src/AppSchemaRenderer.tsx`; the bar that shipped
lives in `ui/packages/app-shell/src/layout/PhoneAppNavBar.tsx`, as the
claim's premise corrected.
- The file surface the claim declared named new test files for this
card; the pins went into the existing harness file instead, by the
AGENTS.md rule above. `overlap-check.mjs` found no open PR sharing a
file with this branch.
- Not done, per the card's 不做的: the bar's four entries are chosen as
before (pinned first, then the menu's first entries); no replacement by
recent use.
- Pre-existing, untouched: eslint's
`react-refresh/only-export-components` warning on the existing
`phoneNavBarEntries` export in `PhoneAppNavBar.tsx`.
## Verification
All readings on `facd9cb9` (the final commit),
`objectstack-ai/objectstack`, worktree off `958ee035`; timings are
shared-box seconds under the verify lock.
<details><summary>Measurement on unchanged bar code (pins committed
first, fix not yet written)</summary>
- `vitest run UnifiedSidebar.phoneNavBar-34594.test.tsx` on `0e82f3d6`
(pins only): `Tests 2 failed | 14 passed (16)`, both failures the
acceptance-1 rows at `expected [] to deeply equal [ 'More' ]` (no cell
lit, More not lit).
- Item 2 alone: the same two rows with the bar assertions removed in the
working tree (restored by `git checkout HEAD`, blob back to `ef2ccdaf`,
`git diff HEAD` empty): `Tests 2 passed | 14 skipped (16)` — the opened
menu selects exactly the page's row on unchanged code.
</details>
<details><summary>Tests, typecheck, ablation</summary>
- `pnpm --dir ui exec vitest run
packages/app-shell/src/layout/__tests__/UnifiedSidebar.phoneNavBar-34594.test.tsx`:
`Tests 16 passed (16)`, VERDICT command-exit 0.
- The 33 `UnifiedSidebar.*`, `ConsoleLayout.*` and
`usePhoneNavDrawerHistory-29131` files under
`ui/packages/app-shell/src/layout/__tests__/`: `Test Files 33 passed
(33)`, `Tests 183 passed (183)`. The full app-shell suite runs in CI
(Test UI); not run locally.
- `pnpm --filter @object-ui/app-shell type-check` (both programs;
`tsconfig.test.json` includes `src/**/*.test.tsx`): VERDICT command-exit
0, after building the app-shell dependency closure.
- Ablation 1 (`node scripts/ablation-replace.mjs`, anchor hit 1, blob
`d772853b` to `0c918a5c`): More lit only while the menu is open, as on
main: `Tests 2 failed | 14 passed (16)`, the acceptance-1 rows.
Restored: blob equals HEAD, `git diff HEAD` empty.
- Ablation 2 (anchor hit 1, blob `d772853b` to `77c6b7d1`): the
drawn-row guard dropped: `Tests 1 failed | 15 passed (16)`, the CONTROL
row for an undrawn entry (`expected [ 'More' ] to deeply equal []`).
Restored: blob equals HEAD, `git diff HEAD` empty.
- No `dist` in the path: the harness imports `../UnifiedSidebar`
relatively and `@object-ui/*` resolves to source through the ui vitest
aliases.
</details>
<details><summary>Gates (derived by dispatch-gates.mjs --commands on
this diff)</summary>
- 38 derived families, every one run on `facd9cb9`, each exit 0;
`dispatch-gates.mjs --ran` answers `38 derived, 38 run, 0 NOT-MEASURED,
0 UNRUN` (a derived zero: every line recorded its exit code).
- Includes `pnpm --dir ui exec vitest run scripts/` (`Test Files 171
passed | 2 skipped (173)`), `pnpm check:type-check-coverage`, `pnpm
check:type-check-debt`, `pnpm check:nul-bytes`, `pnpm
check:published-files`, `pnpm check:test-source-alias`, the changeset
gates and the closing-keyword parity pair.
- Also: `node ui/scripts/check-new-cross-file-line-citations.mjs`: `0
new citation(s)`; control-byte scan of the three changed files: no hit.
- `node scripts/pm/overlap-check.mjs`: `VERDICT clean exit 0` (merges
cleanly with `origin/main`, 0 open PR heads share a file).
- The repo-wide farm is CI's.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01JQwxbXBffgVtUPBEY2nLFm)_
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 4ffe9d3 commit aef42cb
3 files changed
Lines changed: 90 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
132 | | - | |
133 | | - | |
134 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
135 | 147 | | |
136 | 148 | | |
137 | 149 | | |
| |||
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
182 | 197 | | |
183 | | - | |
| 198 | + | |
184 | 199 | | |
185 | 200 | | |
186 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
255 | 315 | | |
256 | 316 | | |
257 | 317 | | |
| |||
0 commit comments