Macos Window Title And Accessibility Focus Fix - Override accessibility method in atom_ns_window - Add title attribute in accessibilityAttributeValue (#14486)
This commit is contained in:
parent
03ef5c25f7
commit
a370b6982d
2 changed files with 15 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "brightray/browser/mac/event_dispatching_window.h"
|
#include "brightray/browser/mac/event_dispatching_window.h"
|
||||||
#include "ui/views/cocoa/native_widget_mac_nswindow.h"
|
#include "ui/views/cocoa/native_widget_mac_nswindow.h"
|
||||||
|
#include "ui/views/widget/native_widget_mac.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ class ScopedDisableResize {
|
||||||
- (id)initWithShell:(atom::NativeWindowMac*)shell
|
- (id)initWithShell:(atom::NativeWindowMac*)shell
|
||||||
styleMask:(NSUInteger)styleMask;
|
styleMask:(NSUInteger)styleMask;
|
||||||
- (atom::NativeWindowMac*)shell;
|
- (atom::NativeWindowMac*)shell;
|
||||||
|
- (id)accessibilityFocusedUIElement;
|
||||||
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
|
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect;
|
||||||
- (void)enableWindowButtonsOffset;
|
- (void)enableWindowButtonsOffset;
|
||||||
- (void)toggleFullScreenMode:(id)sender;
|
- (void)toggleFullScreenMode:(id)sender;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include "atom/browser/native_window_mac.h"
|
#include "atom/browser/native_window_mac.h"
|
||||||
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
#include "atom/browser/ui/cocoa/atom_preview_item.h"
|
||||||
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
#include "atom/browser/ui/cocoa/atom_touch_bar.h"
|
||||||
|
#include "atom/browser/ui/cocoa/root_view_mac.h"
|
||||||
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "ui/base/cocoa/window_size_constants.h"
|
#include "ui/base/cocoa/window_size_constants.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
@ -39,6 +41,13 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
return shell_;
|
return shell_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (id)accessibilityFocusedUIElement {
|
||||||
|
views::Widget* widget = shell_->widget();
|
||||||
|
id superFocus = [super accessibilityFocusedUIElement];
|
||||||
|
if (!widget || shell_->IsFocused())
|
||||||
|
return superFocus;
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect {
|
- (NSRect)originalContentRectForFrameRect:(NSRect)frameRect {
|
||||||
return [super contentRectForFrameRect:frameRect];
|
return [super contentRectForFrameRect:frameRect];
|
||||||
}
|
}
|
||||||
|
@ -91,6 +100,10 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)accessibilityAttributeValue:(NSString*)attribute {
|
- (id)accessibilityAttributeValue:(NSString*)attribute {
|
||||||
|
if ([attribute isEqual:NSAccessibilityTitleAttribute])
|
||||||
|
return base::SysUTF8ToNSString(shell_->GetTitle());
|
||||||
|
if ([attribute isEqual:NSAccessibilityEnabledAttribute])
|
||||||
|
return [NSNumber numberWithBool:YES];
|
||||||
if (![attribute isEqualToString:@"AXChildren"])
|
if (![attribute isEqualToString:@"AXChildren"])
|
||||||
return [super accessibilityAttributeValue:attribute];
|
return [super accessibilityAttributeValue:attribute];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue