refactor!: Clean up roles and properties #289
Merged
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.
I've decided to get as many of these cleanups in as possible before we publish the next release, which has other breaking changes.
I changed "text field" to "text input" because I think the latter is a bit more descriptive and not any longer.
It seems to me that Chromium got "text field" from WebKit, which in turn was influenced by Cocoa/AppKit, given that WebKit began at Apple. The same history also accounts for the old use of a
PopupButton
role for simple combo boxes. I reworked the combo box roles to be more in line with what's common across other platforms, including the web.I think that when we have a flag that only applies to one type of role, it's better to just add another role. That's why I added
Role::DefaultButton
,Role::PasswordInput
, andRole::MultilineTextInput
.I don't want to have any property that is effectively a subrole; I think it's better to have a large, flat list of roles. So, rather than replace the old
input_type
string property with an enum, I added roles for the text input types that we didn't already have. I also established a consistent naming convention for roles that we did already have, likeSearchBox
,Date
,DateTime
, andInputTime
.I'm not entirely sure that we won't ever need the
css_display
andlive_relevant
properties. But I'm also not sure if we want to keep them as strings, so I dropped them for now. Adding them later won't be a breaking change.I dropped
aria_role
because theRole
enum should be comprehensive enough. When in doubt, I bias toward whatever will make AccessKit less confusing and daunting for toolkit developers. In this case, I didn't want them to think that they had to also set the ARIA role as a string.I dropped
indirect_children
because Chromium only uses that property to handle a quirk of how table columns are exposed on macOS. When we get to that, that platform-specific behavior should be confined to the macOS platform adapter.I dropped the
selected_from_focus
flag because Chromium only uses that flag in its Windows UIA implementation, to decide whether to perform the default action when selecting a node. I decided that this can be done better by having distinctSelect
andUnselect
default action verbs, so the platform adapter knows which action would be performed if it does the default action.I haven't done a comprehensive review of all roles yet, but I dropped a few that I'm quite sure are unnecessary and that I think would be confusing.