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

8087557: [Win] [Accessibility, Dialogs] Alert Dialog content is not fully read by Screen Reader #873

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -53,6 +53,7 @@
import javafx.css.StyleableStringProperty;
import javafx.event.ActionEvent;
import javafx.geometry.Pos;
import javafx.scene.AccessibleRole;
import javafx.scene.Node;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.image.Image;
Expand Down Expand Up @@ -209,6 +210,7 @@ static Label createContentLabel(String text) {
*/
public DialogPane() {
getStyleClass().add("dialog-pane");
setAccessibleRole(AccessibleRole.DIALOG);

headerTextPanel = new GridPane();
getChildren().add(headerTextPanel);
Expand Down
Expand Up @@ -25,13 +25,13 @@
package test.javafx.scene.control;

import com.sun.javafx.tk.Toolkit;
import javafx.scene.AccessibleRole;
import javafx.scene.control.ButtonType;
import javafx.scene.control.Dialog;
import javafx.scene.layout.StackPane;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/** Tests for the {@link Dialog} class. */
Expand Down Expand Up @@ -80,6 +80,11 @@ public void testDialogMinHeight() {
assertEquals(minHeight, dialog.getDialogPane().getMinHeight(), 0);
}

@Test
public void testAccessibleRole() {
assertEquals(AccessibleRole.DIALOG, dialog.getDialogPane().getAccessibleRole());
}

@Test
public void testDialogPrefHeight() {
int prefHeight = 400;
Expand Down
Expand Up @@ -1299,6 +1299,7 @@ private MacVariant accessibilityAttributeValue(long attribute) {
case PAGE_ITEM: result = "page"; break;
case TAB_ITEM: result = "tab"; break;
case LIST_VIEW: result = "list"; break;
case DIALOG: result = "dialog"; break;
default:
MacRole macRole = getRole(role);
MacSubrole subRole = MacSubrole.getRole(role);
Expand Down
Expand Up @@ -105,6 +105,7 @@ final class WinAccessible extends Accessible {
private static final int UIA_ToggleToggleStatePropertyId = 30086;
private static final int UIA_AriaRolePropertyId = 30101;
private static final int UIA_ProviderDescriptionPropertyId = 30107;
private static final int UIA_IsDialogPropertyId = 30174;

/* Control Pattern Identifiers */
private static final int UIA_InvokePatternId = 10000;
Expand Down Expand Up @@ -795,6 +796,7 @@ private WinVariant GetPropertyValue(int propertyId) {
switch (role) {
case TITLED_PANE: description = "title pane"; break;
case PAGE_ITEM: description = "page"; break;
case DIALOG: description = "dialog"; break;
default:
}
}
Expand Down Expand Up @@ -834,6 +836,12 @@ private WinVariant GetPropertyValue(int propertyId) {
variant.boolVal = focus != null ? focus : false;
break;
}
case UIA_IsDialogPropertyId: {
AccessibleRole role = (AccessibleRole) getAttribute(ROLE);
variant = new WinVariant();
variant.vt = WinVariant.VT_BOOL;
variant.boolVal = (role == AccessibleRole.DIALOG);
} break;
case UIA_IsContentElementPropertyId:
case UIA_IsControlElementPropertyId: {
//TODO how to handle ControlElement versus ContentElement
Expand Down
Expand Up @@ -822,4 +822,18 @@ public enum AccessibleRole {
* </ul>
*/
TREE_VIEW,

/**
* Dialog role.
* <p>
* Attributes:
* <ul>
* <li> {@link AccessibleAttribute#TEXT} </li>
* <li> {@link AccessibleAttribute#ROLE_DESCRIPTION} </li>
kevinrushforth marked this conversation as resolved.
Show resolved Hide resolved
* <li> {@link AccessibleAttribute#CHILDREN} </li>
* </ul>
*
* @since 20
*/
DIALOG
arapte marked this conversation as resolved.
Show resolved Hide resolved
}
Expand Up @@ -6522,7 +6522,13 @@ Accessible getAccessible() {
}
return getRoot();//not sure
}
case ROLE: return AccessibleRole.PARENT;
case ROLE: {
if (getRoot() != null && getRoot().getAccessibleRole() == AccessibleRole.DIALOG) {
return AccessibleRole.DIALOG;
} else {
return AccessibleRole.PARENT;
}
}
case SCENE: return Scene.this;
case FOCUS_NODE: {
if (transientFocusContainer != null) {
Expand Down