Skip to content

Polish the dialog's accessibility and test growing ColorPickerStrings - #359

Merged
smelfungus merged 4 commits into
masterfrom
dialog-polish
Sep 27, 2026
Merged

smelfungus merged 4 commits into
masterfrom
dialog-polish

Conversation

@smelfungus

Copy link
Copy Markdown
Member

Four changes to the 2.0 dialog that touch its API or what assistive technology hears, cheaper before 2.0 than after, and a check that ColorPickerStrings can grow in 2.x. Builds on #358.

  • The restore is a disabled button, not a missing one. The header made the original half a button only after an edit, so a screen reader met a control that appeared from nowhere. BasicColorComparison and ColorComparison take enabled, and the header keeps the half a button, disabled until the color changes. A disabled restore takes no keyboard focus, and a disabled comparison draws its colors unchanged.
  • The space menu is a list of choices. Beyond five spaces the switcher's button is announced as a drop-down list, and its items as radio buttons in one selectable group, as the segmented row's are.
  • Focus leaves the hidden stacked form. Laid out side by side, the dialog keeps its stacked form composed only to measure it. A slider there that held focus when the dialog flipped kept it while not drawn; the content clears that focus, and only that focus.
  • KDoc says the dialog is announced by ColorPickerStrings.dialogTitle() whatever the title slot shows, that provided strings or a paneTitle in modifier change it, and that an empty spaces with the default initialSpace throws NoSuchElementException. Tests pin the pane-title cases; one fails when the library's pane title is set outside the caller's modifier.

The API dumps change only in the two comparison signatures, each with one Boolean more. The 30 screenshot references validate unchanged.

ColorPickerStrings can grow in 2.x

colorpicker-foundation was published from this branch three times to a local repository: as it is (link1), with one member added to ColorPickerStrings with a body (link2), and with the same member abstract (link3), as a control. A library compiled against link1 holds two implementations: one that overrides dialogTitle() alone, and one that forwards every member to another with by. An app compiled against the later version linked that library and called the new member through each.

Case JVM wasmJs
link2: the override answers the new member with its body passes passes
link2: the forwarder answers it with its body too passes passes
link2: the forwarder, given a base overriding the new member the body, not the base's the body, not the base's
link3, the control: any of the three AbstractMethodError IrLinkageError

So a member added with a body in 2.x reaches an implementation compiled against an earlier 2.x on both platforms, and the control shows the test would have caught it otherwise. On JVM this rests on Kotlin compiling interface bodies to default methods (-jvm-default=enable, the default since Kotlin 2.2); under the older disable mode an added member hits AbstractMethodError even with a body. An implementation that forwards with by forwards only the members it was compiled with: until it is recompiled, it answers a new member with the library's English rather than its base's override.

The dialog's header made the original half a button only once the color was edited, so a screen reader met a plain swatch first and a button after an edit, with nothing saying why it appeared. BasicColorComparison and ColorComparison take enabled, and the header keeps the half a button that is disabled until the color is modified. A disabled comparison draws its colors unchanged: dimmed, the swatch would show colors other than the ones compared.

The header also converts the original color once rather than on every frame of a drag.
Beyond five spaces the switcher is a button that opens a menu. A screen reader heard a button named after the space shown, then menu items with no sign of which one was chosen. The button is a drop-down list and the items are radio buttons in one selectable group, as the segmented row's already are.
The dialog's content stays composed in its stacked form while laid out side by side, only to measure it. A slider there that held keyboard focus when the content flipped, as it does when a window is resized, kept it while not placed: nothing on screen showed where focus was, and the next key moved a slider that was not drawn. The content clears that focus once it lays out side by side, and only that focus.
An app that replaces the title slot still has the dialog announced by ColorPickerStrings.dialogTitle, and needs to know that and the two ways to change it: provided strings, or a paneTitle in the modifier. The last works only because the library sets its own inside the caller's modifier, which a test and a comment now hold in place.

An empty spaces with the default initialSpace throws NoSuchElementException from spaces.first() in the default expression, which the KDoc says beside the IllegalArgumentException cases.
@smelfungus
smelfungus merged commit 2e535da into master Sep 27, 2026
2 checks passed
@smelfungus
smelfungus deleted the dialog-polish branch September 27, 2026 01:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant