From 0c293b8b87439ca5ab0623e8598da53fce789f07 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 12:23:12 +0000 Subject: [PATCH 1/3] fix(fields): the line grid's column-header help no longer joins the column name The info button is named by a short Help word from the pack and described by the help through aria-describedby on a hidden copy, so a screen reader announcing a cell's column reads the label, not the whole help sentence. Claude-Session: https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds Co-authored-by: Claude --- .../fields/src/widgets/GridField.test.tsx | 53 +++++++++++++++++-- ui/packages/fields/src/widgets/GridField.tsx | 53 ++++++++++++------- ui/packages/i18n/src/locales/ar.ts | 1 + ui/packages/i18n/src/locales/de.ts | 1 + ui/packages/i18n/src/locales/en.ts | 5 ++ ui/packages/i18n/src/locales/es.ts | 1 + ui/packages/i18n/src/locales/fr.ts | 1 + ui/packages/i18n/src/locales/ja.ts | 1 + ui/packages/i18n/src/locales/ko.ts | 1 + ui/packages/i18n/src/locales/pt-BR.ts | 1 + ui/packages/i18n/src/locales/ru.ts | 1 + ui/packages/i18n/src/locales/zh-Hans.ts | 1 + ui/packages/i18n/src/locales/zh-Hant.ts | 1 + .../plugin-form/src/MasterDetailForm.test.tsx | 5 +- 14 files changed, 102 insertions(+), 24 deletions(-) diff --git a/ui/packages/fields/src/widgets/GridField.test.tsx b/ui/packages/fields/src/widgets/GridField.test.tsx index 4f7989b5c5f..cf247ab2828 100644 --- a/ui/packages/fields/src/widgets/GridField.test.tsx +++ b/ui/packages/fields/src/widgets/GridField.test.tsx @@ -4,6 +4,8 @@ import React from 'react'; import { UploadProvider } from './UploadProvider'; import { Dialog, DialogContent, DialogTitle } from '@object-ui/components'; import { formatDate, formatDateTime } from '@object-ui/core'; +import { I18nProvider } from '@object-ui/i18n'; +import { en, zh } from '@object-ui/i18n/locales'; import { GridField, LineItemsField, sumColumn, lookupAutofillPatch, UNTOUCHED_NEW_ROW, isUntouchedNewRow, columnHelpByField } from './GridField'; const columns = [ @@ -963,21 +965,21 @@ describe('no trailing entry row beside Add (objectstack#35507)', () => { describe('column header help (objectstack#35804)', () => { const help = { amount: 'Enter the tax-inclusive amount.' }; - it('a column with help draws an info button whose accessible name is the help', () => { + it('a column with help draws an info button named Help and described by the help', () => { render( {}} field={field} columnHelp={help} />); - const button = screen.getByRole('button', { name: 'Enter the tax-inclusive amount.' }); + const button = screen.getByRole('button', { name: 'Help', description: 'Enter the tax-inclusive amount.' }); expect(button.closest('th')!.textContent).toContain('Amount'); }); it('focusing the info button shows the help', async () => { render( {}} field={field} columnHelp={help} />); - fireEvent.focus(screen.getByRole('button', { name: 'Enter the tax-inclusive amount.' })); + fireEvent.focus(screen.getByRole('button', { name: 'Help' })); expect((await screen.findByRole('tooltip')).textContent).toBe('Enter the tax-inclusive amount.'); }); it('the read-only table draws the same help', () => { render( {}} field={field} readonly columnHelp={help} />); - expect(screen.getByRole('button', { name: 'Enter the tax-inclusive amount.' })).toBeTruthy(); + expect(screen.getByRole('button', { name: 'Help', description: 'Enter the tax-inclusive amount.' })).toBeTruthy(); }); it('CONTROL: a column without help draws no info button', () => { @@ -999,6 +1001,49 @@ describe('column header help (objectstack#35804)', () => { }); }); +/** + * objectstack#36004 — a cell's column is announced by its header's accessible + * name, so the help must not join it. The header is named by the field label + * and the info button's short Help word; the help itself is the button's + * description, which a screen reader reads on reaching the button. Computed + * through jest-dom's accname matchers (dom-accessibility-api), on the editable + * grid and on the read-only table alike. + */ +describe('column header help stays out of the column name (objectstack#36004)', () => { + const help = { amount: 'Enter the tax-inclusive amount.' }; + const inLocale = (language: 'en' | 'zh', node: React.ReactNode) => ( + + {node} + + ); + + it.each([ + ['editable grid', false], + ['read-only table', true], + ])('%s: the header is named by the label and Help; the button is described by the help', (_face, readonly) => { + render( + inLocale( + 'en', + {}} field={field} readonly={readonly} columnHelp={help} />, + ), + ); + const button = screen.getByTestId('line-items-column-help'); + const header = button.closest('th')!; + expect(header).toHaveAccessibleName(`Amount ${en.fields.grid.columnHelp}`); + expect(button).toHaveAccessibleName(en.fields.grid.columnHelp); + expect(button).toHaveAccessibleDescription('Enter the tax-inclusive amount.'); + }); + + it('the Help word is read from the pack in the reader\'s language', () => { + expect(zh.fields.grid.columnHelp).not.toBe(en.fields.grid.columnHelp); + render(inLocale('zh', {}} field={field} columnHelp={help} />)); + const button = screen.getByTestId('line-items-column-help'); + expect(button).toHaveAccessibleName(zh.fields.grid.columnHelp); + expect(button).toHaveAccessibleDescription('Enter the tax-inclusive amount.'); + expect(button.closest('th')).toHaveAccessibleName(`Amount ${zh.fields.grid.columnHelp}`); + }); +}); + describe('cell faces that open under the cell (objectstack#36023)', () => { const STATUS = [ { label: 'To Do', value: 'todo' }, diff --git a/ui/packages/fields/src/widgets/GridField.tsx b/ui/packages/fields/src/widgets/GridField.tsx index a51a0f45ab1..99b27cdce5b 100644 --- a/ui/packages/fields/src/widgets/GridField.tsx +++ b/ui/packages/fields/src/widgets/GridField.tsx @@ -740,28 +740,45 @@ export function columnHelpByField(fields: Readonly> | nu /** * The info button beside a column's header label (objectstack#35804): the - * column's help on hover and on keyboard focus, and the button's accessible - * name is the help itself, so a screen reader hears it on reaching the button. - * Its own provider, so the grid draws it under any host. + * column's help on hover and on keyboard focus. + * + * The button sits inside the ``, so its accessible name joins the column + * header's, which a screen reader announces with every cell of the column + * (objectstack#36004). The help is therefore NOT the button's name: the button + * is named by a short Help word from the pack (`fields.grid.columnHelp`), and + * the help is its DESCRIPTION, through `aria-describedby` on a `hidden` copy + * beside it. A hidden node takes no part in the header's name from content, + * and a description reads a node it references even when it is hidden, so a + * screen reader hears "Help" and then the help on reaching the button, while + * the column stays named by its label. The text is the host's, already in the + * reader's language. Its own provider, so the grid draws it under any host. */ function ColumnHeaderHelp({ help }: { help: string | undefined }) { + const { t } = useFieldTranslation(); + const descriptionId = React.useId(); if (!help) return null; return ( - - - - - - {help} - - + <> + + + + + + {help} + + + + ); } diff --git a/ui/packages/i18n/src/locales/ar.ts b/ui/packages/i18n/src/locales/ar.ts index 46595a68b1d..1d5c85a3c80 100644 --- a/ui/packages/i18n/src/locales/ar.ts +++ b/ui/packages/i18n/src/locales/ar.ts @@ -509,6 +509,7 @@ const ar = { openRow: "فتح الصف", duplicateRow: "تكرار الصف", removeRow: "إزالة الصف", + columnHelp: "المساعدة", }, }, table: { diff --git a/ui/packages/i18n/src/locales/de.ts b/ui/packages/i18n/src/locales/de.ts index 0c9a9ed9018..09a2c2161a9 100644 --- a/ui/packages/i18n/src/locales/de.ts +++ b/ui/packages/i18n/src/locales/de.ts @@ -487,6 +487,7 @@ const de = { openRow: "Zeile öffnen", duplicateRow: "Zeile duplizieren", removeRow: "Zeile entfernen", + columnHelp: "Hilfe", }, }, table: { diff --git a/ui/packages/i18n/src/locales/en.ts b/ui/packages/i18n/src/locales/en.ts index 6b694ac31c2..e04d0f5ed83 100644 --- a/ui/packages/i18n/src/locales/en.ts +++ b/ui/packages/i18n/src/locales/en.ts @@ -746,6 +746,10 @@ const en = { // one key, read by both its `aria-label` and its `title`. The chooser's // button reads `table.columns`, the footer `form.masterDetail.total` and // the drag handle `view.dragToReorder`. + // + // objectstack#36004 — `columnHelp` names a column header's info button + // with one short word; the help itself is the button's description, so it + // stays out of the column name a screen reader reads with every cell. grid: { addLine: 'Add line', noItems: 'No items', @@ -755,6 +759,7 @@ const en = { openRow: 'Open row', duplicateRow: 'Duplicate row', removeRow: 'Remove row', + columnHelp: 'Help', }, }, table: { diff --git a/ui/packages/i18n/src/locales/es.ts b/ui/packages/i18n/src/locales/es.ts index 6f887e3f8de..d04f6725d12 100644 --- a/ui/packages/i18n/src/locales/es.ts +++ b/ui/packages/i18n/src/locales/es.ts @@ -496,6 +496,7 @@ const es = { openRow: "Abrir fila", duplicateRow: "Duplicar fila", removeRow: "Quitar fila", + columnHelp: "Ayuda", }, }, table: { diff --git a/ui/packages/i18n/src/locales/fr.ts b/ui/packages/i18n/src/locales/fr.ts index 62e9f45823f..89ab3e9897a 100644 --- a/ui/packages/i18n/src/locales/fr.ts +++ b/ui/packages/i18n/src/locales/fr.ts @@ -491,6 +491,7 @@ const fr = { openRow: "Ouvrir la ligne", duplicateRow: "Dupliquer la ligne", removeRow: "Supprimer la ligne", + columnHelp: "Aide", }, }, table: { diff --git a/ui/packages/i18n/src/locales/ja.ts b/ui/packages/i18n/src/locales/ja.ts index 9f4d1196d3d..5ca8375c324 100644 --- a/ui/packages/i18n/src/locales/ja.ts +++ b/ui/packages/i18n/src/locales/ja.ts @@ -487,6 +487,7 @@ const ja = { openRow: "行を開く", duplicateRow: "行を複製", removeRow: "行を削除", + columnHelp: "ヘルプ", }, }, table: { diff --git a/ui/packages/i18n/src/locales/ko.ts b/ui/packages/i18n/src/locales/ko.ts index fa59c59279e..36d75377dd4 100644 --- a/ui/packages/i18n/src/locales/ko.ts +++ b/ui/packages/i18n/src/locales/ko.ts @@ -487,6 +487,7 @@ const ko = { openRow: "행 열기", duplicateRow: "행 복제", removeRow: "행 삭제", + columnHelp: "도움말", }, }, table: { diff --git a/ui/packages/i18n/src/locales/pt-BR.ts b/ui/packages/i18n/src/locales/pt-BR.ts index 7ea3c3a0d3a..1f7118769fe 100644 --- a/ui/packages/i18n/src/locales/pt-BR.ts +++ b/ui/packages/i18n/src/locales/pt-BR.ts @@ -491,6 +491,7 @@ const pt = { openRow: "Abrir linha", duplicateRow: "Duplicar linha", removeRow: "Remover linha", + columnHelp: "Ajuda", }, }, table: { diff --git a/ui/packages/i18n/src/locales/ru.ts b/ui/packages/i18n/src/locales/ru.ts index 5359d763e74..2a9ca559a6f 100644 --- a/ui/packages/i18n/src/locales/ru.ts +++ b/ui/packages/i18n/src/locales/ru.ts @@ -498,6 +498,7 @@ const ru = { openRow: "Открыть строку", duplicateRow: "Дублировать строку", removeRow: "Удалить строку", + columnHelp: "Помощь", }, }, table: { diff --git a/ui/packages/i18n/src/locales/zh-Hans.ts b/ui/packages/i18n/src/locales/zh-Hans.ts index d7f2c073d94..53740facc9f 100644 --- a/ui/packages/i18n/src/locales/zh-Hans.ts +++ b/ui/packages/i18n/src/locales/zh-Hans.ts @@ -500,6 +500,7 @@ const zh = { openRow: '打开行', duplicateRow: '复制行', removeRow: '删除行', + columnHelp: '帮助', }, }, table: { diff --git a/ui/packages/i18n/src/locales/zh-Hant.ts b/ui/packages/i18n/src/locales/zh-Hant.ts index 11a55632572..c11b53d1d1a 100644 --- a/ui/packages/i18n/src/locales/zh-Hant.ts +++ b/ui/packages/i18n/src/locales/zh-Hant.ts @@ -500,6 +500,7 @@ const zhHant = { openRow: '開啟行', duplicateRow: '複製行', removeRow: '刪除行', + columnHelp: '幫助', }, }, table: { diff --git a/ui/packages/plugin-form/src/MasterDetailForm.test.tsx b/ui/packages/plugin-form/src/MasterDetailForm.test.tsx index 473e762e828..2c146ed35a5 100644 --- a/ui/packages/plugin-form/src/MasterDetailForm.test.tsx +++ b/ui/packages/plugin-form/src/MasterDetailForm.test.tsx @@ -563,9 +563,10 @@ describe('MasterDetailForm — line column headers show the child fields\' help ], ])('%s: each header carries its field\'s help, the form\'s own read of it', async (_label, detail) => { render(); - const qtyHelp = await screen.findByRole('button', { name: 'Whole units only.' }); + // The info button is named Help and described by the help (objectstack#36004). + const qtyHelp = await screen.findByRole('button', { name: 'Help', description: 'Whole units only.' }); expect(qtyHelp.closest('th')!.textContent).toContain('Qty'); - expect(screen.getByRole('button', { name: 'Tax-inclusive.' }).closest('th')!.textContent).toContain('Price'); + expect(screen.getByRole('button', { name: 'Help', description: 'Tax-inclusive.' }).closest('th')!.textContent).toContain('Price'); // CONTROL: a field with no help draws no info button on its header. expect(screen.getByRole('columnheader', { name: 'Note' }).querySelector('button')).toBeNull(); }); From 95a237b015c604cdbe08f4ff5e550336d72c42f5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 12:32:42 +0000 Subject: [PATCH 2/3] chore(changeset): grid header help name Claude-Session: https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds Co-authored-by: Claude --- .changeset/36004-grid-header-help-name.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .changeset/36004-grid-header-help-name.md diff --git a/.changeset/36004-grid-header-help-name.md b/.changeset/36004-grid-header-help-name.md new file mode 100644 index 00000000000..823f572db73 --- /dev/null +++ b/.changeset/36004-grid-header-help-name.md @@ -0,0 +1,15 @@ +--- +'@object-ui/fields': patch +'@object-ui/i18n': patch +--- + +fix(fields): the line grid's column-header help no longer becomes part of every cell's announced column name + +Clause-②: yes (widening) +Metadata-protocol: none + +The widening is additive: the new key `fields.grid.columnHelp` in every locale pack `@object-ui/i18n` publishes through `./locales`, in all eleven locales. + +The info button beside a line grid's column header used the column's help text as its accessible name. The button sits inside the header cell, so the help joined the column header's name, and a screen reader that announces a cell's column read the whole help sentence with every cell of that column. The button is now named by a short "Help" word in the reader's language (`fields.grid.columnHelp`), and the help is its description (`aria-describedby`), read when the button is reached. The column header is named by the field label and that one word. The tooltip on hover and keyboard focus is unchanged, on the editable grid and on the read-only table. + +No metadata key is added or changed. From b2cc52d9643dbdb582bdd4f04ce4c42bc78e627c Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 13:07:12 +0000 Subject: [PATCH 3/3] test(fields): pin the header help's name and description as the accname helper reads them Claude-Session: https://claude.ai/code/session_01QsR2jUc3qp6bHKSWijbjds Co-authored-by: Claude --- ui/packages/fields/src/widgets/GridField.test.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/packages/fields/src/widgets/GridField.test.tsx b/ui/packages/fields/src/widgets/GridField.test.tsx index cf247ab2828..01b5382d802 100644 --- a/ui/packages/fields/src/widgets/GridField.test.tsx +++ b/ui/packages/fields/src/widgets/GridField.test.tsx @@ -1008,6 +1008,12 @@ describe('column header help (objectstack#35804)', () => { * description, which a screen reader reads on reaching the button. Computed * through jest-dom's accname matchers (dom-accessibility-api), on the editable * grid and on the read-only table alike. + * + * dom-accessibility-api treats a button nested in the header as an embedded + * control and leaves its `aria-label` out of the header's name, so it reads the + * label alone whatever the button is named. A browser following accname folds + * that `aria-label` in, so the pin also holds every `aria-label` inside the + * header to the Help word: that is the text a browser adds to the column name. */ describe('column header help stays out of the column name (objectstack#36004)', () => { const help = { amount: 'Enter the tax-inclusive amount.' }; @@ -1029,7 +1035,10 @@ describe('column header help stays out of the column name (objectstack#36004)', ); const button = screen.getByTestId('line-items-column-help'); const header = button.closest('th')!; - expect(header).toHaveAccessibleName(`Amount ${en.fields.grid.columnHelp}`); + expect(header).toHaveAccessibleName('Amount'); + expect(Array.from(header.querySelectorAll('[aria-label]'), (el) => el.getAttribute('aria-label'))).toEqual([ + en.fields.grid.columnHelp, + ]); expect(button).toHaveAccessibleName(en.fields.grid.columnHelp); expect(button).toHaveAccessibleDescription('Enter the tax-inclusive amount.'); }); @@ -1040,7 +1049,7 @@ describe('column header help stays out of the column name (objectstack#36004)', const button = screen.getByTestId('line-items-column-help'); expect(button).toHaveAccessibleName(zh.fields.grid.columnHelp); expect(button).toHaveAccessibleDescription('Enter the tax-inclusive amount.'); - expect(button.closest('th')).toHaveAccessibleName(`Amount ${zh.fields.grid.columnHelp}`); + expect(button.closest('th')).toHaveAccessibleName('Amount'); }); });