RFR: 8284542: Missing attribute for state of CheckBox in CheckBoxTreeItem
Kevin Rushforth
kcr at openjdk.org
Tue May 9 15:14:27 UTC 2023
On Wed, 12 Apr 2023 15:13:25 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:
> Issue:
> CheckBoxTreeItem extends TreeItem and adds a CheckBox.
> The state of this CheckBox is not visible to an accessibility client application.
> If we analyze a simple program that contains a CheckBoxTreeItem using a windows application "Accessibility Insights for Window", we can notice that toggle state of CheckBox is not exposed.
>
> Fix:
> Include the [Toggle Control Pattern](https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-implementingtoggle) in Accessibility information of a CheckBoxTreeItem in addition to the patterns that are used for a TreeItem.
>
> Verification:
> On Windows: Do the following with and without the fix.
> 1. Run the sample program attached to JBS issue.
> 2. Launch "Accessibility Insights for Window"
> 3. Observe that patterns section for each item
> 4. Select / de-select the CheckBoxes and observe the patterns section for correctness of toggle state.
I echo Andy's question about using an enum for the new AccessibleAttribute. More importantly, I think the values of that new attribute need to be a platform-independent. See inline comments.
modules/javafx.controls/src/main/java/javafx/scene/control/cell/CheckBoxTreeCell.java line 495:
> 493: state = 2;
> 494: } else if (checkBox.isSelected()) {
> 495: state = 1;
I recommend using platform-independent constants here (possibly an enum as discussed earlier).
modules/javafx.graphics/src/main/java/com/sun/glass/ui/win/WinAccessible.java line 1588:
> 1586: if (isDisposed()) return 0;
> 1587: if (getAttribute(ROLE) == AccessibleRole.CHECK_BOX_TREE_ITEM) {
> 1588: return (int)getAttribute(TOGGLE_STATE);
I recommend mapping the return value of `getAttribute(TOGGLE_STATE)`, which should be a platform-independent value, to one of the three Windows-specific values. Otherwise you are making an assumption that might not hold for other platforms (e.g., macOS).
-------------
PR Review: https://git.openjdk.org/jfx/pull/1088#pullrequestreview-1417144589
PR Review Comment: https://git.openjdk.org/jfx/pull/1088#discussion_r1188755406
PR Review Comment: https://git.openjdk.org/jfx/pull/1088#discussion_r1188750544
More information about the openjfx-dev
mailing list