refactor!: Rename Checked
to Toggled
; drop ToggleButton
role
#388
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.
ARIA and AT-SPI have both "checked" and "pressed" flags, but they're functionally equivalent; the only difference is that one is for checkboxes while the other is for toggle buttons. I prefer having just one property. AccessKit already had only a "checked" property, which the AT-SPI adapter translated to "pressed" if appropriate. But I think it makes sense to rename our "checked" property to something more generic, since "checked" only makes sense for checkboxes. Here I took some inspiration from UIA, though I went with the more succinct "toggled" rather than UIA's
ToggleState
.I also think it makes sense to not have a dedicated
ToggleButton
role. Instead, now aButton
becomes a toggle button if thetoggled
property is set. This is the same way that buttons become toggle buttons in ARIA.If it seems that I'm being inconsistent about whether to add dedicated roles (as I did in a previous refactor) or use state flags to modify the role (as I'm doing here), the guiding principle is this: eliminate as many invalid combinations of role and state as we can. When I previously eliminated state flags and added more roles instead, the only purpose of the state flag was to modify one specific role. But here, where we have a state property that can be false, true, or unset (unlike the simple flags I previously eliminated), the property serves to both modify the role (two different roles in this case) and indicate some state. The goal is the same, by eliminating the
ToggleButton
role, we make it impossible to mess up the accessibility node by having aToggleButton
with no toggle state, and now, having a plainButton
with toggle state is the one way to do a toggle button.