Skip to content

Commit 6161010

Browse files
fix(console): on a desktop the ⌘⇧H row names the app start page it opens, not the retired home (#37159)
Fixes #37149 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:桌面端快捷键说明和应用切换菜单里,⌘⇧H 那一行从「返回首页」改为「返回应用起始页」;手机端不变,快捷键本身的行为也不变。 - 为什么做:属于「首页退役」收尾工作的最后一项,平台首页已经下线,这一行还在承诺一个不存在的首页。 - 出错会怎样:最坏只是这一行文案读起来别扭,不影响跳转;改动只涉及文案与一行显示逻辑,可直接撤回。 - 要你做什么:无。 ## What changes Measured first (code read at `origin/main` 1f3e9f6): `ConsoleLayout` installs `useGoHomeShortcut(true, useHomePath())`. From 768 px up `useHomePath()` answers `resolveDesktopHomePath(served, lastApp)` — the last-used app, else the declared default, else the first product app — the same answer `/` redirects a desktop to after #36732. Inside an app the last-used app is the app itself (`ConsoleLayout` calls `rememberApp(activeAppName)`), so on a desktop `⌘⇧H` opens the current app's start page; from Studio or the AI pages it opens the last-used app's start page. On a phone it still opens the declared landing or the app list at `/home`. So the chord has a real, working destination on a desktop; only its NAME was stale. I kept the shortcut and retargeted the wording rather than retiring it — retiring would remove a working key users may rely on, which the dispatch reserved as a product decision; renaming changes no behaviour. - `chrome/advertisedShortcuts.ts`: `GO_HOME_SHORTCUT` stays the phone row (「Back to home」, `console.shortcuts.goHome`); new `GO_TO_APP_START_SHORTCUT`, the same id and chord, labelled with `layout.appSwitcher.backToHome` — the key the app pill's row already draws — so the dialog and the pill name one destination. Stale doc (it said `AppHeader` owns the listener) corrected. - `chrome/goHomeShortcut.ts`: the handler is unchanged; it advertises the phone row below 768 px and the desktop row from 768 px up (`usePhoneViewport`). - `layout/AppSwitcher.tsx`: module doc and the row's English default updated. The dropdown is desktop-only (a phone opens the app-list sheet, which has no such row); keycaps unchanged. - `@object-ui/i18n`: value change only, no new key — `layout.appSwitcher.backToHome` in all eleven locales now reads 「Back to app start page」 (zh-Hans 返回应用起始页). That key has one reader, the desktop dropdown row (plus now the desktop dialog row). `console.shortcuts.goHome` is unchanged. Read first, by risk: 1. `ui/packages/app-shell/src/chrome/goHomeShortcut.ts` — the viewport choice of which row to advertise (the only logic change). 2. `ui/packages/app-shell/src/chrome/advertisedShortcuts.ts` — the second advertised constant, same id and chord. 3. `ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx` — the new describe at the end. Two-minute check: run the console at a desktop width inside any app, press `?` to open the keyboard-shortcuts dialog — the Navigation section lists 「Back to app start page ⌘⇧H」; open the app pill — the row reads the same with the same keycaps; press ⌘⇧H — you land on the app's start page. Narrow the window under 768 px and the dialog row reads 「Back to home」. ## Tests Head `7c591386d`. Pins added as a top-level describe in the existing harness `AppHeader.homeMark-12605.test.tsx`, read through the real English catalogue: - desktop (1280 px): the advertised ⌘⇧H row equals `layout.appSwitcher.backToHome` (the pill's words), equals 「Back to app start page」 and does not contain "home"; - CONTROL, phone (375 px): the row stays `console.shortcuts.goHome` 「Back to home」. The switcher pins (`AppSwitcher.homeMenu-12605`, `AppSwitcher.hostSingleApp-12913`) now expect the new row text; the row's href and `⌘⇧H` keycaps assertions are unchanged. <details><summary>Affected tests + i18n package (vitest, from ui/)</summary> ``` pnpm exec vitest run --maxWorkers=2 AppHeader.homeMark-12605 AppSwitcher.homeMenu-12605 AppSwitcher.hostSingleApp-12913 KeyboardShortcutsDialog.wiredOnly-11674 AppHeader.unsavedEditsLeave-13231 SidebarAppMenu-36112 AppHeader.phoneTargets-29075 packages/i18n/ Test Files 117 passed (117) Tests 2106 passed | 13 skipped (2119) os-verify-lock: VERDICT command-exit 0 ``` </details> <details><summary>Reverse verification (one-shot, restored)</summary> `node scripts/ablation-replace.mjs` replaced the desktop arm with `GO_HOME_SHORTCUT` (anchor hit, grep count 1 on disk) and ran the harness: ``` × on a desktop the row names the app start page, in the app pill's words, not a home page Expected: "Back to app start page" Received: "Back to home" Tests 1 failed | 12 passed (13) ablation-replace: ok restored: blob == HEAD (4cfbcce) and `git diff HEAD` is empty ``` The phone CONTROL stayed green under the mutation. No build/dist step: the harness imports app-shell source relatively. </details> <details><summary>Type-check and lint</summary> ``` pnpm --filter @object-ui/i18n run type-check && pnpm --filter @object-ui/app-shell run type-check os-verify-lock: VERDICT command-exit 0 eslint (touched app-shell files): 0 errors, 2 pre-existing no-explicit-any warnings in AppSwitcher.tsx lines 130 and 236 (not in this diff) ``` </details> ## Acceptance notes - Desktop: the dialog row and the pill row both read 「Back to app start page」 with ⌘⇧H, and ⌘⇧H opens that page. Phone: unchanged (dialog row 「Back to home」, no dropdown row, same handler). - Not changed here, outside this card: the pill's 「All apps」 row links to the same `useHomePath()` target as the row above it, so on a desktop it also opens the last-used app's start page rather than any list of apps; other 「Back to home」 surfaces (the not-found and access-denied states, the AI-unavailable page, the product mark's 「PRODUCT home」 name) likewise lead to that start page on a desktop. Reported to the seat as one family; not touched. - Browser check: NOT MEASURED, reason: the destination was established by code read of `useHomePath` / `resolveDesktopHomePath` and is pinned in jsdom; no dev server was started. ## Verification - Derived local gates (`node scripts/pm/dispatch-gates.mjs --commands`, 41 commands): all 41 exited 0; `--ran` reconciliation: 41 derived, 41 run, 0 UNRUN. - `node scripts/pm/overlap-check.mjs`: VERDICT clean (merges cleanly with origin/main and the three open PRs sharing locale files). - E2E collection under CI's config (`cd ui && pnpm exec playwright test --project=chromium --list`): exit 0, 202 tests in 35 files; no spec names the changed row. - CI families: in progress at open; the PR's check-runs are the verdict. --- _Generated by [Claude Code](https://claude.ai/code/session_01QSeKYnagJvGbCtNg2PhvgW)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 06c1f54 commit 6161010

18 files changed

Lines changed: 121 additions & 31 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@object-ui/app-shell': patch
3+
'@object-ui/i18n': patch
4+
---
5+
6+
fix(console): on a desktop the ⌘⇧H row names the app start page it opens, not the retired home page
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
From 768 px up the platform home page is retired: `⌘⇧H` / `Ctrl+Shift+H` (unchanged) opens where `/` lands, the last-used app's start page. The keyboard-shortcuts dialog and the app pill's menu still called that 「Back to home」. On a desktop both now read 「Back to app start page」 (zh: 返回应用起始页), one wording for the one destination; the pill's row keeps its `⌘⇧H` keycaps. A phone, whose Home is still its app list, keeps 「Back to home」 in the dialog.
12+
13+
Locale value change, no new key: `layout.appSwitcher.backToHome` in every built-in locale. No props or exports change.

‎ui/packages/app-shell/src/chrome/advertisedShortcuts.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ export interface AdvertisedShortcut {
6969
}
7070

7171
/**
72-
* `⌘⇧H` / `Ctrl+Shift+H` — back to home from any app page (objectui#12605).
73-
* `AppHeader` owns the listener and advertises this beside it; the app pill's
74-
* 「Back to home」 row draws its keycaps from the same chord, so the row, the
75-
* keyboard-shortcuts dialog and the handler cannot disagree. It lives here,
76-
* not beside either holder, because both read it: a test that stubs one
72+
* `⌘⇧H` / `Ctrl+Shift+H` from any app page (objectui#12605), as a phone
73+
* advertises it: 「Back to home」, because a phone's Home is still its app
74+
* list. The app layout owns the listener (`useGoHomeShortcut`, installed by
75+
* `ConsoleLayout`) and advertises this or {@link GO_TO_APP_START_SHORTCUT}
76+
* beside it; the app pill's row draws its keycaps from the same chord, so the
77+
* row, the keyboard-shortcuts dialog and the handler cannot disagree. It lives
78+
* here, not beside either holder, because both read it: a test that stubs one
7779
* holder's module must not take the other's chord with it.
7880
*/
7981
export const GO_HOME_SHORTCUT: AdvertisedShortcut = {
@@ -83,6 +85,18 @@ export const GO_HOME_SHORTCUT: AdvertisedShortcut = {
8385
label: (t: ShortcutLabelTranslate) => t('console.shortcuts.goHome'),
8486
};
8587

88+
/**
89+
* The same chord as a desktop advertises it. From 768 px up the platform home
90+
* page is retired (objectstack#36732): the chord opens where `/` lands, the
91+
* last-used app's start page (`useHomePath`). So the row says that, in the
92+
* words the app pill's row uses (`layout.appSwitcher.backToHome`), and the
93+
* dialog and the pill name one destination.
94+
*/
95+
export const GO_TO_APP_START_SHORTCUT: AdvertisedShortcut = {
96+
...GO_HOME_SHORTCUT,
97+
label: (t: ShortcutLabelTranslate) => t('layout.appSwitcher.backToHome'),
98+
};
99+
86100
const KEYCAP_TEXT: Record<string, string> = { Escape: 'Esc' };
87101

88102
/** The keycaps the dialog draws for a chord: `{ key: 'k', mod: true }` → `['⌘', 'K']`. */

‎ui/packages/app-shell/src/chrome/goHomeShortcut.ts‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
22

33
/**
4-
* `⌘⇧H` / `Ctrl+Shift+H` — home from any app page. The app layout installs
4+
* `⌘⇧H` / `Ctrl+Shift+H` — Home from any app page: on a phone its app list,
5+
* from 768 px up the last-used app's start page, where `/` lands now the
6+
* platform home page is retired (objectstack#36732). The app layout installs
57
* it (`ConsoleLayout`), at every width, so it does not depend on a top bar
68
* being drawn.
79
* @module
810
*/
911

1012
import { useEffect } from 'react';
1113
import { useNavigate } from 'react-router-dom';
12-
import { GO_HOME_SHORTCUT, useAdvertiseShortcut, type ShortcutChord } from './advertisedShortcuts.js';
14+
import {
15+
GO_HOME_SHORTCUT,
16+
GO_TO_APP_START_SHORTCUT,
17+
useAdvertiseShortcut,
18+
type ShortcutChord,
19+
} from './advertisedShortcuts.js';
1320
import { confirmUnsavedLeave } from './unsavedEdits.js';
21+
import { usePhoneViewport } from '../hooks/usePhoneViewport.js';
1422

1523
/**
1624
* Whether a keydown is `chord`: ⌘ or Ctrl exactly when the chord has `mod`
@@ -40,10 +48,12 @@ function isTypingTarget(target: EventTarget | null): boolean {
4048
}
4149

4250
/**
43-
* `⌘⇧H` / `Ctrl+Shift+H` goes home from any app page, as a PUSH so the
44-
* browser's Back returns to the page (objectui#12605). Advertised beside the
45-
* listener, under the same gate, so the keyboard-shortcuts dialog lists it
46-
* exactly where it fires (objectui#11674).
51+
* `⌘⇧H` / `Ctrl+Shift+H` goes to `homePath` from any app page, as a PUSH so
52+
* the browser's Back returns to the page (objectui#12605). Advertised beside
53+
* the listener, under the same gate, so the keyboard-shortcuts dialog lists it
54+
* exactly where it fires (objectui#11674), and named for where it goes: 「Back
55+
* to home」 on a phone, the last-used app's start page from 768 px up, where
56+
* `useHomePath()` no longer names a home page (objectstack#36732).
4757
*/
4858
export function useGoHomeShortcut(enabled: boolean, homePath: string): void {
4959
const navigate = useNavigate();
@@ -60,6 +70,7 @@ export function useGoHomeShortcut(enabled: boolean, homePath: string): void {
6070
document.addEventListener('keydown', onKeyDown);
6171
return () => document.removeEventListener('keydown', onKeyDown);
6272
}, [enabled, homePath, navigate]);
63-
useAdvertiseShortcut(GO_HOME_SHORTCUT, enabled);
73+
const phone = usePhoneViewport();
74+
useAdvertiseShortcut(phone ? GO_HOME_SHORTCUT : GO_TO_APP_START_SHORTCUT, enabled);
6475
}
6576

‎ui/packages/app-shell/src/layout/AppSwitcher.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
*
1010
* The dropdown (objectui#12605): a 「Switch Application」 group of the
1111
* installed apps with the current one checked — the Setup app is not in it —
12-
* then 「Back to home」 with its `⌘⇧H` keycaps, 「All apps」, and 「Settings」 (the
12+
* then 「Back to app start page」 with its `⌘⇧H` keycaps (where `/` lands from
13+
* 768 px up, the platform home page being retired: objectstack#36732),
14+
* 「All apps」, and 「Settings」 (the
1315
* Setup app, when the viewer's app list carries it). For the viewers the top
1416
* bar offers its Studio button to, 「Edit APP in Studio」 follows a second
1517
* divider; for a read-only package's app it is 「Open APP in Studio」 behind an
@@ -254,7 +256,7 @@ export function AppSwitcher({
254256
<Home className="size-4" />
255257
</span>
256258
<span className="flex-1 truncate">
257-
{t('layout.appSwitcher.backToHome', { defaultValue: 'Back to home' })}
259+
{t('layout.appSwitcher.backToHome', { defaultValue: 'Back to app start page' })}
258260
</span>
259261
<kbd className="pointer-events-none ml-auto font-mono text-xs text-muted-foreground">
260262
{shortcutKeycaps(GO_HOME_SHORTCUT.chord).join('')}

‎ui/packages/app-shell/src/layout/__tests__/AppHeader.homeMark-12605.test.tsx‎

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,14 @@ vi.mock('../../hooks/useLauncherApps', async (importOriginal) => ({
134134

135135
import { AppHeader } from '../AppHeader';
136136
import { CommandPaletteProvider } from '../../context/CommandPaletteProvider';
137-
import { GO_HOME_SHORTCUT, useAdvertisedShortcuts, type ShortcutChord } from '../../chrome/advertisedShortcuts';
137+
import {
138+
GO_HOME_SHORTCUT,
139+
useAdvertisedShortcuts,
140+
type ShortcutChord,
141+
type ShortcutLabelTranslate,
142+
} from '../../chrome/advertisedShortcuts';
138143
import { getProductName } from '../../runtime-config';
144+
import { en } from '@object-ui/i18n';
139145
import { useGoHomeShortcut } from '../../chrome/goHomeShortcut';
140146

141147
const MEMBER: MePermissionsAuthenticatedResponse = {
@@ -335,3 +341,45 @@ describe('CONTROL — the home page draws the same mark and leaves the chord alo
335341
expect(trigger.nextElementSibling).toBe(mark());
336342
});
337343
});
344+
345+
describe('the advertised ⌘⇧H row names where the chord goes (objectstack#37149)', () => {
346+
/** The English catalogue the shipped console reads, looked up by dotted key. */
347+
const english: ShortcutLabelTranslate = (key) =>
348+
String(key.split('.').reduce<unknown>((node, part) => (node as Record<string, unknown> | undefined)?.[part], en) ?? key);
349+
350+
/** The row the keyboard-shortcuts dialog draws for the chord, in English. */
351+
function LabelReading() {
352+
const row = useAdvertisedShortcuts().find((s) => s.id === GO_HOME_SHORTCUT.id);
353+
return <output data-testid="go-home-row" data-label={row ? row.label(english) : ''} />;
354+
}
355+
356+
const realWidth = window.innerWidth;
357+
function mountAt(width: number) {
358+
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: width });
359+
render(
360+
<MemoryRouter initialEntries={['/apps/crm/lead']}>
361+
<GoHomeShortcut />
362+
<LabelReading />
363+
</MemoryRouter>,
364+
);
365+
return screen.getByTestId('go-home-row').dataset.label;
366+
}
367+
afterEach(() => {
368+
Object.defineProperty(window, 'innerWidth', { configurable: true, writable: true, value: realWidth });
369+
});
370+
371+
// From 768 px up the platform home page is retired: the chord opens where
372+
// `/` lands, the last-used app's start page, and the row says so in the
373+
// app pill's own words, so the dialog and the pill name one destination.
374+
it('on a desktop the row names the app start page, in the app pill\'s words, not a home page', () => {
375+
const label = mountAt(1280);
376+
expect(label).toBe(english('layout.appSwitcher.backToHome'));
377+
expect(label).toBe('Back to app start page');
378+
expect(label).not.toMatch(/home/i);
379+
});
380+
381+
it('CONTROL — on a phone, whose Home is still its app list, the row keeps 「Back to home」', () => {
382+
expect(mountAt(375)).toBe(english('console.shortcuts.goHome'));
383+
expect(english('console.shortcuts.goHome')).toBe('Back to home');
384+
});
385+
});

‎ui/packages/app-shell/src/layout/__tests__/AppSwitcher.homeMenu-12605.test.tsx‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
*
77
* - The 「Switch Application」 group lists the installed apps with the current
88
* one checked; the Setup app is not in it.
9-
* - After a divider: 「Back to home」 with the `⌘⇧H` keycaps, 「All apps」 and
9+
* - After a divider: 「Back to app start page」 with the `⌘⇧H` keycaps (the
10+
* platform home page is retired from 768 px up, objectstack#36732), 「All
11+
* apps」 and
1012
* 「Settings」 (the Setup app), in that order.
1113
* - For a viewer the top bar offers its Studio button to, 「Edit APP in
1214
* Studio」 follows a second divider.
@@ -108,7 +110,7 @@ beforeEach(() => {
108110
});
109111

110112
describe('the app pill\'s menu (objectui#12605)', () => {
111-
it('the switch group, then Back to home → All apps → Settings, then the Studio row after a second divider', () => {
113+
it('the switch group, then Back to app start page → All apps → Settings, then the Studio row after a second divider', () => {
112114
renderSwitcher('hotcrm', '/studio/com.acme.hotcrm/data');
113115
expect(menuOutline()).toEqual([
114116
'label',
@@ -122,7 +124,7 @@ describe('the app pill\'s menu (objectui#12605)', () => {
122124
'divider',
123125
'app-switcher-edit-in-studio',
124126
]);
125-
expect(menu().getByTestId('app-switcher-home')).toHaveTextContent('Back to home');
127+
expect(menu().getByTestId('app-switcher-home')).toHaveTextContent('Back to app start page');
126128
expect(menu().getByTestId('app-switcher-all-apps')).toHaveTextContent('All apps');
127129
// objectstack#27521 row 1 — the entry carries the Setup app's own label,
128130
// the name its header shows once it is open.
@@ -144,7 +146,7 @@ describe('the app pill\'s menu (objectui#12605)', () => {
144146
expect(menu().getByTestId('app-switcher-row-hotcrm_service').querySelector('.text-primary')).toBeNull();
145147
});
146148

147-
it('「Back to home」 links to home and shows the ⌘⇧H keycaps', () => {
149+
it('「Back to app start page」 links to where `/` lands and shows the ⌘⇧H keycaps', () => {
148150
renderSwitcher('hotcrm');
149151
const home = menu().getByTestId('app-switcher-home');
150152
// objectstack#36732 — from 768 px up home is where `/` lands (no last app

‎ui/packages/app-shell/src/layout/__tests__/AppSwitcher.hostSingleApp-12913.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ describe('CONTROLS (objectui#12913)', () => {
160160
expect(screen.getByTestId('app-switcher-trigger')).toHaveAttribute('title', 'Cloud');
161161
const menu = within(screen.getByTestId('app-switcher-menu'));
162162
expect(menu.getByTestId('app-switcher-row-cloud_control')).toBeInTheDocument();
163-
expect(menu.getByTestId('app-switcher-home')).toHaveTextContent('Back to home');
163+
expect(menu.getByTestId('app-switcher-home')).toHaveTextContent('Back to app start page');
164164
expect(menu.getByTestId('app-switcher-all-apps')).toHaveTextContent('All apps');
165165
});
166166
});

‎ui/packages/i18n/src/locales/ar.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4195,7 +4195,7 @@ const ar = {
41954195
allApps: "جميع التطبيقات",
41964196
editAppInStudio: "تعديل {{app}} في Studio",
41974197
openAppInStudio: "عرض {{app}} في Studio",
4198-
backToHome: "العودة إلى الرئيسية",
4198+
backToHome: "العودة إلى صفحة بدء التطبيق",
41994199
settings: "الإعدادات",
42004200
productHome: "الصفحة الرئيسية لـ {{product}}",
42014201
addApp: 'إضافة تطبيق',

‎ui/packages/i18n/src/locales/de.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3864,7 +3864,7 @@ const de = {
38643864
allApps: "Alle Apps",
38653865
editAppInStudio: "{{app}} im Studio bearbeiten",
38663866
openAppInStudio: "{{app}} im Studio ansehen",
3867-
backToHome: "Zurück zur Startseite",
3867+
backToHome: "Zurück zur Startseite der App",
38683868
settings: "Einstellungen",
38693869
productHome: "{{product}} Startseite",
38703870
addApp: 'App hinzufügen',

‎ui/packages/i18n/src/locales/en.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4624,7 +4624,7 @@ const en = {
46244624
allApps: 'All apps',
46254625
editAppInStudio: 'Edit {{app}} in Studio',
46264626
openAppInStudio: 'Open {{app}} in Studio',
4627-
backToHome: 'Back to home',
4627+
backToHome: 'Back to app start page',
46284628
settings: 'Settings',
46294629
productHome: '{{product}} home',
46304630
addApp: 'Add app',

0 commit comments

Comments
 (0)