Repository navigation
Pick dates from a calendar, and give colour fields a real picker - #63
Merged
Merged
Conversation
Feedback: people did not know what to type into the builder's date settings, or in what format; and the front-end colour field rendered as a full-width native swatch that read as a broken checkbox. Builder: every date and time setting — earliest/latest date and time, default answers on date/time/datetime fields, and the form's open/close schedule — is now a native date/time picker that stores the ISO shape the server compares against while showing the reader's own locale. A click anywhere on the box opens the calendar, the native icon is replaced by a dashicon that stays visible on a dark desktop, a clear button returns to "no limit", and a hand-typed legacy value is named instead of blanked. A datetime field's bounds use a date-and-time picker, since a bare date is not a valid `min` for datetime-local. Front end: the colour field is a hex text box (the one named input, which works without JavaScript) with a chip that opens a picker — saturation/ brightness area, hue track, optional suggested swatches, the EyeDropper where supported, and "No colour" on optional fields. It is drawn entirely from the form theme's tokens so it fits every theme, is keyboard operable, and an untouched optional colour now posts empty instead of #000000. Values normalise to lower-case six-digit hex on both sides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The swatch was a native `<input type=color>` laid over the hex box. In the builder window, wp-admin's `input[type=…]` rules outranked it: the swatch picked up a grey frame and the code sat jammed against the colour. It is now `<os-color-field>` when the kit is loaded (already in the component list), drawn in shadow DOM from the shell's tokens like every other swatch on the desktop. It sits beside the box in a flex row with the shell's spacing, has a clear button for "no default", and shows a struck tile, in the shell's well and muted ink, when empty. The raw native input remains the fallback, held at two classes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Two pieces of feedback:
<input type="color" class="atf-input">rendered as a full-width native swatch that read as a broken checkbox. It also couldn't be empty, so an optional colour nobody touched posted#000000.What changed
Builder: dates are picked, not typed
dateInput()insrc/ui.ts, used for earliest/latest date, earliest/latest time, default answers on date/time/datetime fields, and the form's Open from / Closes schedule.2026-10-31,09:30,2026-10-31T09:30) and shows it in the reader's own locale.showPicker()).color-schemefollows the box's actual background.31/10/2026) is named under the box instead of being silently blanked.minfordatetime-local.colorInput()for their default: swatch, hex box, and it can be left empty.Front end: a colour picker that fits every theme
pattern, and is still the one named input.src/color-picker.tsturns the chip into a button that opens a panel:swatchessetting on the Colour field)--atf-surface,--atf-border,--atf-radius-*, focus ring, accent…), with radii capped so pill themes don't distort it. The theme-token contract tests still pass.aria-expanded/aria-controlson the button androle="dialog"on the panelinput/changeevents, so logic, validation and submission see one value. It also works in repeater rows added later.alltfo_normalize_hex_color()↔normalizeHex(), with matching test tables). Inline validation reports a malformed code.Tests
tests/phpunit/tests/colorField.php: markup, empty value, default, pattern, swatch cleaning (including an injection attempt), normaliser table, sanitisation. Full PHPUnit run: 793 OK.tests/vitest/color-picker.test.ts: colour maths, enhancement, keyboard, swatches, clear, close behaviour, "only one input".tests/vitest/date-settings.test.ts: date/time/datetime boxes, clear, legacy-value note, dark detection, colour default control.tscclean, PHPCS unchanged from baseline.QA (localhost:8889)
input[type=text]padding outranked the hex box's single-class rule, so the swatch covered the first digit.🤖 Generated with Claude Code