-
Notifications
You must be signed in to change notification settings - Fork 6k
Present tooltip to screen reader on Windows #36799
Conversation
b5d5909 to
7136adf
Compare
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the approach we are going to take, the code looks good to me. Do you know what's native behavior for tooltip?
cbracken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just need to bump the new value to the end of the FlutterSemanticsNode struct.
| target->GetString16Attribute(ax::mojom::StringAttribute::kTooltip); | ||
| if (!tooltip.empty()) { | ||
| AppendTextToString(tooltip, &name); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like UIA has better support for tooltips via the UIA_HelpTextPropertyId property. At some point, we should plan to do some research into how much effort would be required to migrate from MSAA to UIA, but this seems like a reasonable approach given the constraints of MSAA.
From looking at the MSAA docs, native Win32 tooltips are modelled as a new window with their own nodes in the a11y tree. I'm not entirely sure what the "right" behaviour for Flutter tooltips is. For example, if we needed to support hit-testing on tooltips, we'd probably want to model them as a separate node with their own extent etc. This seems like a reasonable stopgap fix for the time being though. |
cbracken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.

For now at least, this PR will mostly serve as feedback for how to actually represent the tooltip in the MSAA node on Windows. Currently, I am appending it to the end of the Name field. We can change this to a different approach if desired. I will add/modify tests once we are sure of the approach to use.
Addresses flutter/flutter#112876
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.