Skip to content

Commit 32a5792

Browse files
committed
fix(components,i18n): drop the now-unread validation.formInvalid key and bring two comments in line
Claude-Session: https://claude.ai/code/session_01CzUs1oNtFWhWUXT7rmoGy2 Co-authored-by: Claude <noreply@anthropic.com>
1 parent cb3fe1a commit 32a5792

12 files changed

Lines changed: 17 additions & 20 deletions

File tree

‎.changeset/25874-form-refusal-no-field-toast.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
'@object-ui/components': patch
3+
'@object-ui/i18n': patch
34
---
45

56
fix(components): a refused submit moves focus to the first invalid field and no longer toasts the field list over the dialog's title
@@ -11,3 +12,4 @@ Metadata-protocol: none
1112
- **Now.** The form raises no toast for a refusal that every field carries inline. It scrolls to the first invalid field in form order and focuses it, and first activates that field's tab when it is on a background tab. The message under each input is the whole report.
1213
- **A field with nothing drawn to carry it.** When the server rejects a field that has no drawn input, for example one on a tab or section a `visibleWhen` predicate hides, the form shows the form-level banner and its toast with the server's sentence, the same path a rejection naming an unknown field already takes. The hidden tab is not activated.
1314
- **Earlier outcomes retire.** A refusal on the client now takes down the previous attempt's banner and toast, and a clear-on-hide notice, as an attempt that passes validation already did. Before, the refusal toast replaced them under the form's outcome id.
15+
- **`validation.formInvalid` removed.** The toast's sentence ("Please check the highlighted fields: {{fields}}") had no other reader, so it leaves the form's default map and all ten `@object-ui/i18n` locale packs. `validation.formInvalidJoiner` stays: the clear-on-hide notice, the faulted-`visibleWhen` refusal and the option-group hint still join field labels with it. A host bundle that overrides `validation.formInvalid` can drop the entry; nothing reads it.

‎ui/packages/components/src/renderers/form/form.tsx‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -472,12 +472,12 @@ const useSafeFormTranslation = createSafeTranslation(
472472
'validation.pattern': '{{field}} format is invalid',
473473
'validation.email': 'Please enter a valid email address',
474474
'validation.url': 'Please enter a valid URL',
475-
'validation.formInvalid': 'Please check the highlighted fields: {{fields}}',
476475
// objectstack#5407 — the joiner between the field names is a LOCALE
477476
// property, not a code constant. It used to be a hardcoded `、` (U+3001),
478477
// which is right for zh/ja and wrong everywhere else — including `en`,
479-
// where the toast read "Subject、Account、Status". A locale that ships no
480-
// entry falls back through i18next to `en`'s ", ".
478+
// where the invalid-submit toast (since removed, objectstack#25874) read
479+
// "Subject、Account、Status". A locale that ships no entry falls back
480+
// through i18next to `en`'s ", ".
481481
'validation.formInvalidJoiner': ', ',
482482
'errors.forbidden': 'Access denied.',
483483
'form.noPermissionToSave': "You don't have permission to save this record.",
@@ -2484,11 +2484,13 @@ ComponentRegistry.register('form',
24842484
// ruling on objectui#8070 (letter A) ports the naming half of the
24852485
// objectui#6499 ruling to this surface: the user is told WHICH fields were
24862486
// cleared and WHY. So a pass that empties anything raises one notice naming
2487-
// the cleared fields by the label the form draws (the source
2488-
// `validation.formInvalid` names them from), joined by the locale's own
2489-
// `validation.formInvalidJoiner`, under `outcomeToastId`. Sharing that id
2490-
// is what makes it retire like the form's other outcome messages: a later
2491-
// submit refusal replaces it, and the next accepted attempt dismisses it.
2487+
// the cleared fields by the label the form draws (`fieldLabelByName`),
2488+
// joined by the locale's own `validation.formInvalidJoiner`, under
2489+
// `outcomeToastId`. Sharing that id is what makes it retire like the form's
2490+
// other outcome messages: every later submit attempt takes it down. One
2491+
// that clears validation and a client-side refusal (whose report is the
2492+
// inline field messages, objectstack#25874) both dismiss the id, and the
2493+
// faulted-`visibleWhen` refusal dismisses it before raising its own.
24922494
//
24932495
// Only a field that held something is named. An empty list is rewritten
24942496
// as itself, and `false` on a two-state control is that control's EMPTY

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ const ar = {
172172
email: "يرجى إدخال بريد إلكتروني صالح",
173173
url: "يرجى إدخال رابط صالح",
174174
pattern: "صيغة {{field}} غير صالحة",
175-
formInvalid: "يرجى التحقق من الحقول المميزة: {{fields}}",
176175
formInvalidJoiner: "، ",
177176
unique: "{{field}} يجب أن يكون فريداً",
178177
type: "{{field}} يجب أن يكون {{type}} صالحاً",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ const de = {
158158
email: "Bitte geben Sie eine gültige E-Mail-Adresse ein",
159159
url: "Bitte geben Sie eine gültige URL ein",
160160
pattern: "{{field}} hat ein ungültiges Format",
161-
formInvalid: "Bitte überprüfen Sie die markierten Felder: {{fields}}",
162161
formInvalidJoiner: ", ",
163162
unique: "{{field}} muss eindeutig sein",
164163
type: "{{field}} muss ein gültiger {{type}} sein",

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,14 @@ const en = {
202202
email: 'Please enter a valid email address',
203203
url: 'Please enter a valid URL',
204204
pattern: '{{field}} format is invalid',
205-
formInvalid: 'Please check the highlighted fields: {{fields}}',
206-
// Separator between the field names interpolated into `formInvalid`.
205+
// Separator between the field labels a form names in one sentence: the
206+
// record form's clear-on-hide notice (`form.clearedOnHide`) and
207+
// faulted-`visibleWhen` refusal (`form.visibleWhenFaulted`), and the
208+
// option-group "select the parent first" hint (`fields.options.selectFirst`).
207209
// Per-locale because list punctuation is a locale property, not a code
208210
// constant: CJK enumerates with U+3001, Latin scripts with a comma+space,
209211
// Arabic with U+060C. Hardcoding one of them in the renderer put the CJK
210-
// comma into the English toast (objectstack#5407).
212+
// comma into the English invalid-submit toast (objectstack#5407).
211213
formInvalidJoiner: ', ',
212214
unique: '{{field}} must be unique',
213215
type: '{{field}} must be a valid {{type}}',

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ const es = {
165165
email: "Por favor, introduzca un correo electrónico válido",
166166
url: "Por favor, introduzca una URL válida",
167167
pattern: "El formato de {{field}} no es válido",
168-
formInvalid: "Por favor, revise los campos resaltados: {{fields}}",
169168
formInvalidJoiner: ", ",
170169
unique: "El campo {{field}} debe ser único",
171170
type: "{{field}} debe ser un {{type}} válido",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ const fr = {
160160
email: "Veuillez saisir une adresse e-mail valide",
161161
url: "Veuillez saisir une URL valide",
162162
pattern: "Le format de {{field}} est invalide",
163-
formInvalid: "Veuillez vérifier les champs en surbrillance : {{fields}}",
164163
formInvalidJoiner: ", ",
165164
unique: "{{field}} doit être unique",
166165
type: "{{field}} doit être un {{type}} valide",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ const ja = {
158158
email: "有効なメールアドレスを入力してください",
159159
url: "有効なURLを入力してください",
160160
pattern: "{{field}}の形式が正しくありません",
161-
formInvalid: "ハイライトされた項目を確認してください: {{fields}}",
162161
formInvalidJoiner: "、",
163162
unique: "{{field}}は一意である必要があります",
164163
type: "{{field}}は有効な{{type}}である必要があります",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ const ko = {
158158
email: "유효한 이메일 주소를 입력해주세요",
159159
url: "유효한 URL을 입력해주세요",
160160
pattern: "{{field}} 형식이 올바르지 않습니다",
161-
formInvalid: "표시된 필드를 확인해 주세요: {{fields}}",
162161
formInvalidJoiner: ", ",
163162
unique: "{{field}}은(는) 고유해야 합니다",
164163
type: "{{field}}은(는) 유효한 {{type}}이어야 합니다",

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ const pt = {
160160
email: "Por favor, insira um endereço de e-mail válido",
161161
url: "Por favor, insira uma URL válida",
162162
pattern: "O formato de {{field}} é inválido",
163-
formInvalid: "Verifique os campos destacados: {{fields}}",
164163
formInvalidJoiner: ", ",
165164
unique: "{{field}} deve ser único",
166165
type: "{{field}} deve ser um {{type}} válido",

0 commit comments

Comments
 (0)