Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AccessibleRole::Image and use it in the AboutSlint widget #7593

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DataTriny
Copy link
Contributor

Introduces a new AccessibleRole to represent images and maps it to the appropriate role for each accessibility backend. The role could be set by default but (1) it would probably have to be done in a compiler pass and (2) the Image widget is already used extensively to represent icons and other visual elements that really should not be part of the accessibility tree, so it would be annoying to set accessible-role: none everywhere.

I took this opportunity to improve the AboutSlint widget. I chose "#MadeWithSlint" as the label because I think this is the most important piece of information carried out by the image, but this is your branding so feel free to suggest something else.

@DataTriny DataTriny changed the title Accessible image Add AccessibleRole::Image and use it in the AboutSlint widget Feb 10, 2025
@ogoffart
Copy link
Member

We set the default role for Text there.

fn apply_builtin(e: &ElementRc) {

But it is true that if in practice, the images won't have a label by default so it might not be so useful to apply the role if no label is set?
I'll let you be the judge of that.

The patch looks good but perhaps the documentation of the image role could be extended a bit to explain that it is not set by default (if we choose not to set it by default) and what kind of image it should apply to in combination to what other accessible properties.

Copy link
Member

@tronical tronical left a comment

Choose a reason for hiding this comment

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

My guts feeling is that it makes sense to let this be opt-in: exposing the image to assistive tech when there is a label, and otherwise not.

(I thought perhaps it would make sense to have a default for the label extracted from image metadata, but that may not be translated or contextually correct)

@DataTriny
Copy link
Contributor Author

Even images without alternative description can be useful these days. If I launch the Gallery app with the Windows Narrator running, then go to the About tab, navigate to the image and press CapsLock+Control+D, the image is described as "A logo for a company". Not super great, but I think recent VoiceOver versions have better image recognition models built-in. If we make images accessible by default, I'm afraid they will be cluttered by irrelevant nodes. We'd have to hide the "check-mark" icon on the CheckBox for instance because keeping it would be annoying.

I agree that the accessible role should be mentioned on the documentation of the Image element.

@ogoffart
Copy link
Member

I think recent VoiceOver versions have better image recognition models built-in.

How is the image data given to the model?

@tronical
Copy link
Member

Perhaps via grabbing the pixels from the framebuffer? The bounds of the image/node within the window are known.

@DataTriny
Copy link
Contributor Author

Perhaps via grabbing the pixels from the framebuffer? The bounds of the image/node within the window are known.

Yes I think that's exactly how it works. But for that the assistive technology have to know that there is a node on which it can perform image recognition, hence this new role.

I'll do the documentation tomorrow.

@DataTriny
Copy link
Contributor Author

I'm not entirely sure whether images should be part of the accessibility tree by default or not, and I wouldn't want to make a bad choice for Slint. I'm going to reach out to more knowledgeable people to discuss this matter and I'll update you here.

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.

3 participants