From 26a1bf72a2a32b002e51f910e8faa300333bb6c3 Mon Sep 17 00:00:00 2001 From: Codex Date: Mon, 7 Sep 2026 21:06:00 +0300 Subject: [PATCH] Keep browser autofill within canonical field colors --- apps/catalog/src/CatalogApp.tsx | 2 +- docs/COMPONENTS.md | 2 +- packages/ui-core/styles.css | 14 ++++++++++++++ registry/components.json | 3 ++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/apps/catalog/src/CatalogApp.tsx b/apps/catalog/src/CatalogApp.tsx index e9ceeab..b97f582 100644 --- a/apps/catalog/src/CatalogApp.tsx +++ b/apps/catalog/src/CatalogApp.tsx @@ -1610,7 +1610,7 @@ export function CatalogApp() { CANONICAL GLASS

Модальное окно и Inspector

Фон остаётся различимым, но текст и контролы сохраняют контраст. Этот материал не применяется к обычным панелям приложения.

-
+
diff --git a/docs/COMPONENTS.md b/docs/COMPONENTS.md index 23f27b7..a12060f 100644 --- a/docs/COMPONENTS.md +++ b/docs/COMPONENTS.md @@ -39,7 +39,7 @@ Icon-only action по умолчанию круглый. Квадратная к ## Field -FieldFrame объединяет label, control, hint и description. TextField/TextAreaField реализуют стандартные текстовые поля. +FieldFrame объединяет label, control, hint и description. TextField/TextAreaField реализуют стандартные текстовые поля. Автозаполнение браузера сохраняет материал поля, цвет текста и каретки текущей темы; синяя системная заливка не используется. Клавиатурный фокус остаётся видимым. Приложение не должно вручную собирать label и input, если подходит Field. Ошибка и validation state будут расширением этого контракта, а не локальным классом приложения. diff --git a/packages/ui-core/styles.css b/packages/ui-core/styles.css index 869d011..1d1dc49 100644 --- a/packages/ui-core/styles.css +++ b/packages/ui-core/styles.css @@ -350,6 +350,20 @@ box-shadow: var(--nodedc-glass-control-shadow), inset 0 0 0 1px rgb(var(--nodedc-accent-rgb) / 0.22); } +/* Browsers enforce their autofill background with an internal !important rule. + Paint the canonical field material above it; keep text, caret and keyboard + focus in the same theme as manually entered values. */ +.nodedc-field__control:is(:autofill, :-webkit-autofill) { + -webkit-text-fill-color: var(--nodedc-text-primary); + caret-color: var(--nodedc-text-primary); + box-shadow: inset 0 0 0 100vmax var(--nodedc-field-bg); +} + +.nodedc-field__control:is(:autofill, :-webkit-autofill):focus-visible { + box-shadow: inset 0 0 0 1px rgb(var(--nodedc-accent-rgb) / 0.22), + inset 0 0 0 100vmax var(--nodedc-field-bg); +} + textarea.nodedc-field__control { min-height: 6rem; padding-block: 0.85rem; diff --git a/registry/components.json b/registry/components.json index 7761647..2d746c1 100644 --- a/registry/components.json +++ b/registry/components.json @@ -109,7 +109,8 @@ "summary": "Textual form controls with consistent labels, hints, geometry and focus surface.", "rules": [ "Labels and validation copy are part of the field contract.", - "Keyboard focus changes the surface and remains visible without a browser-blue outline." + "Keyboard focus changes the surface and remains visible without a browser-blue outline.", + "Browser autofill retains the canonical field material, text and caret; keyboard focus remains visible." ] }, {