Skip to content

Accessibility#21

Open
wash2 wants to merge 6 commits intoiced-rs:masterfrom
wash2:accessibility
Open

Accessibility#21
wash2 wants to merge 6 commits intoiced-rs:masterfrom
wash2:accessibility

Conversation

@wash2
Copy link
Copy Markdown

@wash2 wash2 commented Feb 2, 2023


## Motivation

Accessibility support is an important feature for GUI toolkits. [Accesskit](https://github.com/AccessKit/accesskit) provides a cross-platform interface for interacting with accessibility software. It is still a work in progress, but already supports many widget types, and is used in egui. Accesibility support is currently missing in Iced, but could be implemented using Accesskit and the strategies in this proposal.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Accessibility support is an important feature for GUI toolkits. [Accesskit](https://github.com/AccessKit/accesskit) provides a cross-platform interface for interacting with accessibility software. It is still a work in progress, but already supports many widget types, and is used in egui. Accesibility support is currently missing in Iced, but could be implemented using Accesskit and the strategies in this proposal.
Accessibility support is an important feature for GUI toolkits. [Accesskit](https://github.com/AccessKit/accesskit) provides a cross-platform interface for interacting with accessibility software. It is still a work in progress, but already supports many widget types, and is used in egui. Accessibility support is currently missing in Iced, but could be implemented using Accesskit and the strategies in this proposal.

}
```

Buttons have a single child, which may also have children, so its implementation is requires an extra step of handling the children nodes. It is also more interactible than static text, so we can define actions that the accessibility tools may request to the widget.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Buttons have a single child, which may also have children, so its implementation is requires an extra step of handling the children nodes. It is also more interactible than static text, so we can define actions that the accessibility tools may request to the widget.
Buttons have a single child, which may also have children, so its implementation requires an extra step of handling the children nodes. It is also more interactible than static text, so we can define actions that the accessibility tools may request to the widget.


### A11yId

Accessibility Nodes need relatively consistent Ids for each element in the tree. A11yId is built using a slightly modified version of the existing `iced_native::widget::id::Id`. Because `iced_native` will depend on `iced_accessibility` the `Id` type is moved to `iced_core` and be re-exported by `iced_native`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Accessibility Nodes need relatively consistent Ids for each element in the tree. A11yId is built using a slightly modified version of the existing `iced_native::widget::id::Id`. Because `iced_native` will depend on `iced_accessibility` the `Id` type is moved to `iced_core` and be re-exported by `iced_native`.
Accessibility Nodes need consistent IDs for each element in the tree. A11yId is built using a slightly modified version of the existing `iced_native::widget::id::Id`. Because `iced_native` will depend on `iced_accessibility` the `Id` type is moved to `iced_core` and re-exported by `iced_native`.

});
}
```
- reset widget Id counter before building the UserInterface
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems very brittle to me as the IDs are tied to the order in which widgets are created. If for some reason a widget change its place in the "creation chain" during one frame, AccessKit will be confused.

Copy link
Copy Markdown
Author

@wash2 wash2 Jun 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, ya this is a bit out of date, and I did run into exactly the issue you describe. After our short discussion earlier, I've decided to instead persist widget IDs when possible during the diff step. I will update the RFC to reflect the changes. Does that seem to be a better approach in your opinion?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I recall, egui also computes a hash of some sort to generate IDs, which can be valid as well even though there's a tiny chance of collision.
If you can retain IDs between frames, it's indeed safer.

- Maybe there should be more helper methods for the different widget types?
- What related issues do you consider out of scope for this RFC that could be addressed in the future independently of the solution that comes out of this RFC?

Actual Widget implementations are somewhat out of scope of this RFC. Of course I hope that most widgets can be easily implemented with the skeleton proposed here, but it may become useful to define templates for different `Node`s or more helpers for building `A11yTree`s
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you wanted this to replace the last item in the list above?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes 😅

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.

2 participants