Repository navigation
#306: a control's name lives only in its face - #311
Merged
Merged
Conversation
`ButtonChain::named` and `ButtonOptions::named` are gone. A text face's name is its text, an icon face's is its `(icon, "Name")` tuple and an empty face's is `Face::Empty(name)`, so a button can no longer be named twice with no documented winner. Breaking: `.named(..)` on a button or on `ButtonOptions` no longer compiles. A button whose accessible name differs from its label (the dialog example's Role picker) is now read by its label. Tests: compile-fail doctests for both methods; the AccessKit name of an icon button, an icon toggle, a text button and an icon dropdown's trigger and menu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP
`ToggleChain::named` (and so a toggle-group member's) and `DropdownChain::named` are gone. A dropdown's trigger and menu are both named by its face. Breaking: `.named(..)` on a toggle or dropdown no longer compiles. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP
`Face::text("···").named("The levels between")` shows the text and is
read by the name, for buttons, toggles, toggle-group members and
dropdowns (whose trigger and menu both take it). The name still has one
source, the face: `Face::Label` now holds a `TextFace`, and `named` is
only on it, so an icon face, named by its tuple, cannot be named again.
The dialog example's Role picker keeps its name: it shows the role and
is read as "Role".
Breaking: `Face::Label` holds a `TextFace`, not a `String`.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP
Owner
Author
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.
Fixes #306.
A control with a face now takes its accessible name only from that face. This covers the button, toggle, toggle-group member and dropdown (whose face names both its trigger and its menu).
.named(..)is gone from their chains and fromButtonOptions, so a control can no longer be named twice.A text face can still be read by a name other than its text. The name sits in the face itself:
Face::text("···").named("The levels between").The face API
"Save"/String: shows the text and is read by it (unchanged).(icon, "Close"): an icon read as "Close" (unchanged).Face::Empty(name): shows nothing and is read byname(unchanged).Face::text(text) -> TextFaceandTextFace::named(name).namedexists only onTextFace.Breaking changes
b.button(k, "Viewer").named("Role")b.button(k, Face::text("Viewer").named("Role"))b.button(k, (icon, "Close")).named("Close")b.button(k, (icon, "Close"))b.button(k, "").named("Undo")b.button(k, Face::Empty("Undo".into()))b.toggle(k, "B", on).named("Bold")b.toggle(k, Face::text("B").named("Bold"), on)b.toggle_item(&g, v, "B").named("Bold")b.toggle_item(&g, v, Face::text("B").named("Bold"))b.dropdown_menu(k, "···").named("The levels between")b.dropdown_menu(k, Face::text("···").named("The levels between"))ButtonOptions::new().named("Do it")Face::Label(String)Face::Label(TextFace). Build it withFace::text(..)or"…".into().The
.namedmethods on controls without a face stay:Behaviour
Unchanged. The dialog example's Role picker still shows the role and is read as "Role", now through
Face::text(..).named("Role").Tests
.named(..)no longer compiles on:ButtonChainButtonOptionsToggleChainDropdownChainFacean_icon_faces_name_is_what_assistive_technology_reads: the AccessKit name is the tuple name for an icon button and an icon toggle, and the text for a text button.an_icon_dropdowns_name_names_its_trigger_and_its_menua_text_face_with_a_name_is_read_by_the_name_and_shows_the_text: each of these paints its text, while AccessKit reads its name:a_renamed_dropdown_names_its_trigger_and_its_menu: the "···" dropdown's open menu and its trigger are both read as "The levels between".TextFace's name fails both renamed-face tests.Prose for you
TODO(prose)placeholders:Face::textTextFaceTextFace::namedFacedocsButtonChain,ToggleChainandDropdownChainnamedwere cut down, because stale links break the doc build. Both are insrc/owned/button.rs:Face::name: now "What assistive technology reads."ButtonChaindocs: now "An empty label or name is reported as Unnamed."Stale prose I left alone:
docs/overlays.md:690lists.namedamongDropdownChain's methods.cargo xtask ciexits 0 on ea6c87d (main fdb6b62).🤖 Generated with Claude Code
https://claude.ai/code/session_01PWiKKf74MNWrhkW1CvKVUP