Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5359)

Unified Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm

Issue 2478733002: Page Info (native Mac): remove images from accessibility order (Closed)
Patch Set: Separate the hack into a method for conceptual isolation (and maintainability). Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
diff --git a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
index 8c2e8a66239b08de8a38f93ab04a18a384941324..46823011f58260178690ae136f26c31d9f72d415 100644
--- a/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm
@@ -619,18 +619,30 @@ bool IsInternalURL(const GURL& url) {
}
// Add an image as a subview of the given view, placed at a pre-determined x
-// position and the given y position. Return the new NSImageView.
+// position and the given y position. The image is not in the accessibility
+// order, since the image is always accompanied by text in this bubble. Return
+// the new NSImageView.
- (NSImageView*)addImageWithSize:(NSSize)size
toView:(NSView*)view
atPoint:(NSPoint)point {
NSRect frame = NSMakeRect(point.x, point.y, size.width, size.height);
base::scoped_nsobject<NSImageView> imageView(
[[NSImageView alloc] initWithFrame:frame]);
+ [self hideImageFromAccessibilityOrder:imageView];
[imageView setImageFrameStyle:NSImageFrameNone];
[view addSubview:imageView.get()];
return imageView.get();
}
+// Hide the given image view from the accessibility order for VoiceOver.
+- (void)hideImageFromAccessibilityOrder:(NSImageView*)imageView {
+ // This is the minimum change necessary to get VoiceOver to skip the image
+ // (instead of reading the word "image"). Accessibility mechanisms in OSX
+ // change once in a while, so this may be fragile.
+ [[imageView cell] accessibilitySetOverrideValue:@""
+ forAttribute:NSAccessibilityRoleAttribute];
+}
+
// Add a separator as a subview of the given view. Return the new view.
- (NSView*)addSeparatorToView:(NSView*)view {
// Use an arbitrary position; it will be adjusted in performLayout.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698