Skip to content

Commit 20c18be

Browse files
author
Alexander Zuev
committed
8358092: Create accessibility protocol implementation that covers various type of menu items
Reviewed-by: angorya, arapte
1 parent eca3e38 commit 20c18be

File tree

3 files changed

+106
-1
lines changed

3 files changed

+106
-1
lines changed

modules/javafx.graphics/src/main/native-glass/mac/a11y/AccessibleBase.m

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ + (void) initializeRolesMap {
4040
* All JavaFX roles and corresponding available properties are defined in
4141
* enum javafx.scene.AccessibleRole
4242
*/
43-
rolesMap = [[NSMutableDictionary alloc] initWithCapacity:16];
43+
rolesMap = [[NSMutableDictionary alloc] initWithCapacity:21];
4444

4545
[rolesMap setObject:@"JFXButtonAccessibility" forKey:@"BUTTON"];
4646
[rolesMap setObject:@"JFXButtonAccessibility" forKey:@"DECREMENT_BUTTON"];
@@ -59,6 +59,10 @@ + (void) initializeRolesMap {
5959
[rolesMap setObject:@"JFXImageAccessibility" forKey:@"IMAGE_VIEW"];
6060
[rolesMap setObject:@"JFXTabGroupAccessibility" forKey:@"TAB_PANE"];
6161
[rolesMap setObject:@"JFXTabGroupAccessibility" forKey:@"PAGINATION"];
62+
[rolesMap setObject:@"JFXMenuItemAccessibility" forKey:@"MENU"];
63+
[rolesMap setObject:@"JFXMenuItemAccessibility" forKey:@"MENU_ITEM"];
64+
[rolesMap setObject:@"JFXMenuItemAccessibility" forKey:@"RADIO_MENU_ITEM"];
65+
[rolesMap setObject:@"JFXMenuItemAccessibility" forKey:@"CHECK_MENU_ITEM"];
6266

6367
}
6468

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
27+
#import "JFXButtonAccessibility.h"
28+
#import <AppKit/NSAccessibility.h>
29+
30+
@interface JFXMenuItemAccessibility : AccessibleBase {
31+
};
32+
33+
- (NSAccessibilityRole)accessibilityRole;
34+
- (id)accessibilityValue;
35+
- (NSRect)accessibilityFrame;
36+
- (id)accessibilityTitleUIElement;
37+
@end
38+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation. Oracle designates this
8+
* particular file as subject to the "Classpath" exception as provided
9+
* by Oracle in the LICENSE file that accompanied this code.
10+
*
11+
* This code is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
* version 2 for more details (a copy is included in the LICENSE file that
15+
* accompanied this code).
16+
*
17+
* You should have received a copy of the GNU General Public License version
18+
* 2 along with this work; if not, write to the Free Software Foundation,
19+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20+
*
21+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+
* or visit www.oracle.com if you need additional information or have any
23+
* questions.
24+
*/
25+
26+
#import "JFXMenuItemAccessibility.h"
27+
28+
@implementation JFXMenuItemAccessibility
29+
30+
- (NSAccessibilityRole)accessibilityRole
31+
{
32+
return NSAccessibilityMenuItemRole;
33+
}
34+
35+
- (NSString * _Nullable)accessibilityLabel {
36+
return [super accessibilityTitle];
37+
}
38+
39+
- (NSString * _Nullable)accessibilityTitle {
40+
return [self requestNodeAttribute:@"AXMenuItemMarkChar"];
41+
}
42+
43+
- (id)accessibilityTitleUIElement
44+
{
45+
return [super accessibilityTitleUIElement];
46+
}
47+
48+
- (id)accessibilityValue
49+
{
50+
return [super accessibilityValue];
51+
}
52+
53+
- (NSRect)accessibilityFrame
54+
{
55+
return [super accessibilityFrame];
56+
}
57+
58+
- (id)accessibilityParent
59+
{
60+
return [super accessibilityParent];
61+
}
62+
@end
63+

0 commit comments

Comments
 (0)