Skip to content

Commit

Permalink
Add kAccessibilityFocusFallsbackToWidget property
Browse files Browse the repository at this point in the history
- Added kAccessibilityFocusFallsbackToWidget property to aura::Window.
- Default value of kAccessibilityFocusFallsbackToWidget is true.
- kAccessibilityFocusFallsbackToWidget is set to false for arc window.

BUG=661061
TEST=manually tested as described in the issue; User can navigate
     elements in Android window by using TalkBack.
     interactive_ui_tests:SpokenFeedbackTest

Review-Url: https://codereview.chromium.org/2530073002
Cr-Commit-Position: refs/heads/master@{#437469}
  • Loading branch information
yawano authored and Commit bot committed Dec 9, 2016
1 parent 9ea86d5 commit 7f0cf5b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,11 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, OverviewMode) {
break;
}

EXPECT_EQ("Entered window overview mode", speech_monitor_.GetNextUtterance());
while (true) {
std::string utterance = speech_monitor_.GetNextUtterance();
if (utterance == "Entered window overview mode")
break;
}

SendKeyPress(ui::VKEY_TAB);
// On Chrome OS accessibility title for tabbed browser windows contains app
Expand Down Expand Up @@ -534,9 +538,12 @@ IN_PROC_BROWSER_TEST_P(SpokenFeedbackTest, MAYBE_ChromeVoxShiftSearch) {

// Press Search+/ to enter ChromeVox's "find in page".
SendKeyPressWithSearch(ui::VKEY_OEM_2);
EXPECT_EQ(", window", speech_monitor_.GetNextUtterance());
EXPECT_EQ("webView", speech_monitor_.GetNextUtterance());
EXPECT_EQ("Find in page.", speech_monitor_.GetNextUtterance());

while (true) {
std::string utterance = speech_monitor_.GetNextUtterance();
if (utterance == "Find in page.")
break;
}
}

#if defined(MEMORY_SANITIZER)
Expand Down
2 changes: 2 additions & 0 deletions components/exo/shell_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,8 @@ void ShellSurface::CreateShellSurfaceWidget(ui::WindowShowState show_state) {

aura::Window* window = widget_->GetNativeWindow();
window->SetName("ExoShellSurface");
window->SetProperty(aura::client::kAccessibilityFocusFallsbackToWidgetKey,
false);
window->AddChild(surface_->window());
window->SetEventTargeter(base::WrapUnique(new CustomWindowTargeter(widget_)));
SetApplicationId(window, application_id_);
Expand Down
1 change: 1 addition & 0 deletions ui/aura/client/aura_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ namespace client {

// Alphabetical sort.

DEFINE_WINDOW_PROPERTY_KEY(bool, kAccessibilityFocusFallsbackToWidgetKey, true);
DEFINE_WINDOW_PROPERTY_KEY(bool, kAlwaysOnTopKey, false);
DEFINE_WINDOW_PROPERTY_KEY(bool, kAnimationsDisabledKey, false);
DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::ImageSkia, kAppIconKey, nullptr);
Expand Down
5 changes: 5 additions & 0 deletions ui/aura/client/aura_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ namespace client {

// Alphabetical sort.

// A property key to store whether accessibility focus falls back to widget or
// not.
AURA_EXPORT extern const WindowProperty<bool>* const
kAccessibilityFocusFallsbackToWidgetKey;

// A property key to store always-on-top flag.
AURA_EXPORT extern const WindowProperty<bool>* const kAlwaysOnTopKey;

Expand Down
10 changes: 9 additions & 1 deletion ui/views/accessibility/ax_aura_obj_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "base/memory/ptr_util.h"
#include "base/memory/singleton.h"
#include "base/strings/string_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/focus_client.h"
#include "ui/aura/window.h"
#include "ui/views/accessibility/ax_aura_obj_wrapper.h"
Expand Down Expand Up @@ -160,8 +162,14 @@ View* AXAuraObjCache::GetFocusedView() {
View* focused_view = focus_manager->GetFocusedView();
if (focused_view)
return focused_view;
else

if (focused_window->GetProperty(
aura::client::kAccessibilityFocusFallsbackToWidgetKey)) {
// If no view is focused, falls back to root view.
return focused_widget->GetRootView();
}

return nullptr;
}

void AXAuraObjCache::OnWindowFocused(aura::Window* gained_focus,
Expand Down

0 comments on commit 7f0cf5b

Please sign in to comment.