From 44c192df524407cf9a02c9133ce1d0c6928c381c Mon Sep 17 00:00:00 2001 From: DerekAgility Date: Mon, 28 Sep 2026 10:46:29 -0400 Subject: [PATCH] Form controls: 36px single-line height and consistent thin focus Single-line inputs had no fixed height (py-2 + leading-5 + border = 38px), so they sat 2px taller than the default h-9 Button, and their height shifted with @tailwindcss/forms and stylesheet order. InputField, TextInput, the add-on / animated-label inputs, NestedInputButton, TextInputSelect, Select, Combobox and the DropdownWithMultiSelect trigger are now a fixed h-9. Focus on text inputs and select triggers is a single 1px violet-700 border. The ring is zeroed with focus:!ring-0 because a plain focus:ring-0 ties with the forms plugin's focus rule and loses when a consumer's forms styles load after plenum's. Error and readonly borders are kept on focus. Button, both ButtonDropdown halves, Capsule, ToggleSwitch, Checkbox and Radio show their focus ring for keyboard focus only (focus-visible), not on click. Adds a Form Control States story, tests for the new classes, a changelog entry, and bumps the version to 2.6.0. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 67 +++ package.json | 2 +- stories/atoms/buttons/Button/Button.tsx | 14 +- stories/atoms/buttons/Capsule/Capsule.tsx | 4 +- .../FormControlStates.stories.tsx | 415 ++++++++++++++++++ .../inputs/InputField/InputField.tsx | 13 +- .../InputField/tests/InputField.test.tsx | 64 +++ .../NestedInputButton/NestedInputButton.tsx | 4 +- .../molecules/inputs/TextInput/TextInput.tsx | 9 +- .../molecules/inputs/checkbox/Checkbox.tsx | 4 +- .../molecules/inputs/combobox/ComboBox.tsx | 11 +- stories/molecules/inputs/radio/Radio.tsx | 11 +- stories/molecules/inputs/select/Select.tsx | 12 +- .../tests/FormControlConsistency.test.tsx | 248 +++++++++++ .../inputs/toggleSwitch/ToggleSwitch.tsx | 2 +- .../AnimatedFormInputWithAddons.tsx | 2 +- .../AnimatedLabelInput/AnimatedLabelInput.tsx | 2 +- .../ButtonDropdown/ButtonDropdown.tsx | 4 +- .../DropdownWithMultiSelect.tsx | 2 +- .../organisms/TextInputSelect/InputSelect.tsx | 11 +- .../TextInputSelect/TextInputSelect.tsx | 11 +- 21 files changed, 867 insertions(+), 45 deletions(-) create mode 100644 stories/molecules/inputs/FormControlStates/FormControlStates.stories.tsx create mode 100644 stories/molecules/inputs/InputField/tests/InputField.test.tsx create mode 100644 stories/molecules/inputs/tests/FormControlConsistency.test.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ecbc5e7..ceda3e1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,72 @@ # Changelog +## 2.6.0 + +**Visual change for every form.** Single-line inputs are now 2px shorter, and focus styles are +thinner and consistent. Check forms that set their own input heights or focus styles. + +### Changed: single-line controls are 36px, matching Button + +Inputs had no fixed height. `py-2` + `leading-5` + a 1px border made them 38px, while the default +`Button` is `h-9` (36px), so an input next to a button sat 2px taller. The height also changed +depending on whether `@tailwindcss/forms` was loaded and in which order: 22–24px without it, and +42px when a consumer's forms styles loaded after plenum's. + +These are now a fixed `h-9` (36px) with `py-0` and the text vertically centred, whatever CSS is loaded: + +| Control | Before | After | +| --- | --- | --- | +| `InputField` (and so `TextInput`, including `date` / `datetime-local`) | 38px | 36px | +| `FormInputWithAddons`, `AnimatedLabelInput`, `AnimatedFormInputWithAddons` | 38px | 36px | +| `NestedInputButton` (the add-on button inside the above) | 38px | 36px | +| `TextInputSelect`: input and native ``**, **`Combobox`** and **`NestedInputButton`** used + `focus:ring-1 focus:ring-purple-500` plus a purple border. They now use the same 1px `violet-700` + border. `NestedInputButton` and the `DropdownWithMultiSelect` trigger show it for keyboard focus + only (`focus-visible`). +- **Error and readonly states keep their red / gray border on focus.** Previously `Select` and + `Combobox` in error turned purple on focus. `TextInput` and `TextInputSelect` now also set + `aria-invalid="true"` on the input when `isError` is set. + +### Changed: button and toggle focus rings show for keyboard focus only + +`Button` (both the `