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

8267066: New NSAccessibility peers should return they roles and subroles directly #4162

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -31,6 +31,7 @@
@interface ButtonAccessibility : CommonComponentAccessibility <NSAccessibilityButton> {

};
- (nullable NSString *)accessibilityLabel;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (BOOL)accessibilityPerformPress;
@end
@@ -29,7 +29,12 @@
* Implementation of the accessibility peer for the pushbutton role
*/
@implementation ButtonAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityButtonRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}
@@ -28,5 +28,6 @@
@interface CheckboxAccessibility : ButtonAccessibility <NSAccessibilityCheckBox> {

};
- (id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (id _Nonnull)accessibilityValue;

This comment has been minimized.

@pankaj-bansal

pankaj-bansal May 25, 2021

Looks like the value can be null. No?

This comment has been minimized.

@azuev-java

azuev-java May 25, 2021
Author Member

Not here. The value here is a state of the checkbox - checked or not checked, unlike text components where value can be set to null, here value is being generated from the component state and can not be null.

@end
@@ -31,8 +31,12 @@
* Implementation of the accessibility peer for the checkbox role
*/
@implementation CheckboxAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityCheckBoxRole;
}

- (id) accessibilityValue
- (id _Nonnull) accessibilityValue
{
AWT_ASSERT_APPKIT_THREAD;
return [self accessibilityValueAttribute];
@@ -41,7 +41,7 @@
+ (void) initializeRolesMap;
+ (JavaComponentAccessibility * _Nullable) getComponentAccessibility:(NSString * _Nonnull)role;
- (NSRect)accessibilityFrame;
- (nullable id)accessibilityParent;
- (id _Nullable)accessibilityParent;
- (BOOL)performAccessibleAction:(int)index;
- (BOOL)isAccessibilityElement;
@end
@@ -164,7 +164,7 @@ - (NSRect)accessibilityFrame
return NSMakeRect(point.x, point.y, size.width, size.height);
}

- (nullable id)accessibilityParent
- (id _Nullable)accessibilityParent
{
return [self accessibilityParentAttribute];
}
@@ -34,9 +34,9 @@
@interface CommonTextAccessibility : CommonComponentAccessibility {

}
- (nullable NSString *)accessibilityValueAttribute;
- (NSString * _Nullable)accessibilityValueAttribute;
- (NSRange)accessibilityVisibleCharacterRangeAttribute;
- (nullable NSString *)accessibilityStringForRangeAttribute:(NSRange)parameter;
- (NSString * _Nullable)accessibilityStringForRangeAttribute:(NSRange)parameter;
@end

#endif
@@ -31,6 +31,6 @@
@interface GroupAccessibility : CommonComponentAccessibility <NSAccessibilityGroup> {

};

- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSArray * _Nullable)accessibilityChildren;
@end
@@ -32,6 +32,10 @@
* classes reflecting the logic of the class.
*/
@implementation GroupAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityGroupRole;
}

/*
* Return all non-ignored children.
@@ -31,5 +31,6 @@
@interface ImageAccessibility : CommonComponentAccessibility <NSAccessibilityImage> {

};
- (nullable NSString *)accessibilityLabel;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
@end
@@ -29,7 +29,12 @@
* Implementation of the accessibility peer for the icon role
*/
@implementation ImageAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityImageRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}
@@ -28,5 +28,6 @@
@interface RadiobuttonAccessibility : ButtonAccessibility <NSAccessibilityRadioButton> {

};
- (id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (id _Nonnull)accessibilityValue;

This comment has been minimized.

@pankaj-bansal

pankaj-bansal May 25, 2021

Same as earlier. Can't this be null?

This comment has been minimized.

@azuev-java

azuev-java May 25, 2021
Author Member

Same here, value represents the state of the control and can not be set to null.

@end
@@ -31,8 +31,12 @@
* Implementation of the accessibility peer for the radiobutton role
*/
@implementation RadiobuttonAccessibility
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityRadioButtonRole;
}

- (id) accessibilityValue
- (id _Nonnull) accessibilityValue
{
AWT_ASSERT_APPKIT_THREAD;
return [self accessibilityValueAttribute];
@@ -31,7 +31,7 @@
@interface ScrollAreaAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSArray * _Nullable)accessibilityContents;
- (id _Nullable)accessibilityHorizontalScrollBar;
- (id _Nullable)accessibilityVerticalScrollBar;
@@ -83,9 +83,9 @@ - (id _Nullable)getScrollBarwithOrientation:(enum NSAccessibilityOrientation)ori
return nil;
}

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityScrollAreaRole;
}

- (NSArray * _Nullable)accessibilityContents
@@ -31,6 +31,6 @@
@interface ScrollBarAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSAccessibilityOrientation) accessibilityOrientation;
@end
@@ -32,9 +32,9 @@
*/
@implementation ScrollBarAccessibility

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityScrollBarRole;
}

- (NSAccessibilityOrientation) accessibilityOrientation
@@ -31,9 +31,9 @@
@interface SliderAccessibility : CommonComponentAccessibility <NSAccessibilitySlider> {

};

- (nullable NSString *)accessibilityLabel;
- (nullable id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (id _Nullable)accessibilityValue;
- (BOOL)accessibilityPerformDecrement;
- (BOOL)accessibilityPerformIncrement;
@end
@@ -32,12 +32,17 @@
* Implementation of the accessibility peer for the slider role
*/
@implementation SliderAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilitySliderRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}

- (nullable id)accessibilityValue
- (id _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
@@ -31,9 +31,9 @@
@interface SpinboxAccessibility : CommonComponentAccessibility <NSAccessibilityStepper> {

};

- (nullable NSString *)accessibilityLabel;
- (nullable id)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityLabel;
- (id _Nullable)accessibilityValue;
- (BOOL)accessibilityPerformDecrement;
- (BOOL)accessibilityPerformIncrement;
@end
@@ -32,12 +32,17 @@
* Implementation of the accessibility peer for the spinner role
*/
@implementation SpinboxAccessibility
- (nullable NSString *)accessibilityLabel
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityIncrementorRole;
}

- (NSString * _Nullable)accessibilityLabel
{
return [self accessibilityTitleAttribute];
}

- (nullable id)accessibilityValue
- (id _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
@@ -34,8 +34,9 @@
@interface StaticTextAccessibility : CommonTextAccessibility<NSAccessibilityStaticText> {

};
- (nullable NSString *)accessibilityAttributedStringForRange:(NSRange)range;
- (nullable NSString *)accessibilityValue;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
- (NSString * _Nullable)accessibilityAttributedStringForRange:(NSRange)range;
- (NSString * _Nullable)accessibilityValue;
- (NSRange)accessibilityVisibleCharacterRange;
@end
#endif
@@ -27,12 +27,17 @@

@implementation StaticTextAccessibility

- (nullable NSString *)accessibilityAttributedStringForRange:(NSRange)range
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return NSAccessibilityStaticTextRole;
}

- (NSString * _Nullable)accessibilityAttributedStringForRange:(NSRange)range
{
return [self accessibilityStringForRangeAttribute:range];
}

- (nullable NSString *)accessibilityValue
- (NSString * _Nullable)accessibilityValue
{
return [self accessibilityValueAttribute];
}
@@ -31,5 +31,5 @@
@interface ToolbarAccessibility : CommonComponentAccessibility {

};
- (NSString * _Nonnull)accessibilityRole;
- (NSAccessibilityRole _Nonnull)accessibilityRole;
@end
@@ -30,8 +30,8 @@
*/
@implementation ToolbarAccessibility

- (NSString * _Nonnull)accessibilityRole
- (NSAccessibilityRole _Nonnull)accessibilityRole
{
return [self accessibilityRoleAttribute];
return NSAccessibilityToolbarRole;
}
@end