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

Unified Diff: Source/core/accessibility/AXObjectCache.cpp

Issue 101193002: Send AX focus changed events for modal dialog open/close (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: refactoring Created 7 years 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
Index: Source/core/accessibility/AXObjectCache.cpp
diff --git a/Source/core/accessibility/AXObjectCache.cpp b/Source/core/accessibility/AXObjectCache.cpp
index 950b465e1631fe9d9d3ef2f458929255275033e8..97834d58c90f7d25e0847c1d2ffcfa05b4ea9a59 100644
--- a/Source/core/accessibility/AXObjectCache.cpp
+++ b/Source/core/accessibility/AXObjectCache.cpp
@@ -58,6 +58,7 @@
#include "core/dom/Document.h"
#include "core/frame/Frame.h"
#include "core/html/HTMLAreaElement.h"
+#include "core/html/HTMLDialogElement.h"
#include "core/html/HTMLImageElement.h"
#include "core/html/HTMLInputElement.h"
#include "core/html/HTMLLabelElement.h"
@@ -167,6 +168,14 @@ AXObject* AXObjectCache::focusedUIElementForPage(const Page* page)
if (!focusedNode)
focusedNode = focusedDocument;
+ // If a modal dialog is active, let it have default focus instead of the document. JAWS
dmazzoni 2013/12/10 08:07:53 I'd eliminate the comment about JAWS here - I thin
+ // seems to rely on focus changing within the document to update its AT tree, so otherwise
+ // JAWS will allow navigation into inert content.
+ if (focusedNode == focusedDocument) {
dmazzoni 2013/12/10 08:07:53 Would it be possible that focus is outside the dia
falken 2013/12/10 12:19:57 It's possible if you have something like: <body>
+ if (HTMLDialogElement* dialog = focusedDocument->activeModalDialog())
+ focusedNode = dialog;
+ }
+
if (isHTMLAreaElement(focusedNode))
return focusedImageMapUIElement(toHTMLAreaElement(focusedNode));
@@ -996,18 +1005,15 @@ void AXObjectCache::postPlatformNotification(AXObject* obj, AXNotification notif
&& obj->node() == obj->document()->focusedElement()) {
// Calling handleFocusedUIElementChanged will focus the new active
// descendant and send the AXFocusedUIElementChanged notification.
- handleFocusedUIElementChanged(0, obj->document()->focusedElement());
+ handleFocusedUIElementChanged(*obj->document());
}
client.postAccessibilityNotification(obj, notification);
}
-void AXObjectCache::handleFocusedUIElementChanged(Node*, Node* newFocusedNode)
+void AXObjectCache::handleFocusedUIElementChanged(const Document& document)
{
- if (!newFocusedNode)
- return;
-
- Page* page = newFocusedNode->document().page();
+ Page* page = document.page();
if (!page)
return;

Powered by Google App Engine
This is Rietveld 408576698