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

Unified Diff: third_party/WebKit/Source/core/events/EventDispatcher.cpp

Issue 1655153003: Fire an accessible click event when a web node is clicked on. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fire_clicked_event
Patch Set: Added test for tap Created 4 years, 10 months 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: third_party/WebKit/Source/core/events/EventDispatcher.cpp
diff --git a/third_party/WebKit/Source/core/events/EventDispatcher.cpp b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
index f6ad638c6b532bcaeeb316a0ee4f10f7288d01d3..7a015828608c082f69cd97415580df1ef25b8a65 100644
--- a/third_party/WebKit/Source/core/events/EventDispatcher.cpp
+++ b/third_party/WebKit/Source/core/events/EventDispatcher.cpp
@@ -202,9 +202,16 @@ inline void EventDispatcher::dispatchEventPostProcess(void* preDispatchEventHand
// Pass the data from the preDispatchEventHandler to the postDispatchEventHandler.
m_node->postDispatchEventHandler(m_event.get(), preDispatchEventHandlerResult);
+ bool isClick = m_event->isMouseEvent() && toMouseEvent(*m_event).type() == EventTypeNames::click;
+ if (isClick) {
+ // Fire an accessibility event indicating a node was clicked on. This is safe if m_event->target()->toNode() returns null.
+ if (AXObjectCache* cache = m_node->document().existingAXObjectCache())
+ cache->handleClicked(m_event->target()->toNode());
+ }
+
// The DOM Events spec says that events dispatched by JS (other than "click")
// should not have their default handlers invoked.
- bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionEnabled() || m_event->isTrusted() || (m_event->isMouseEvent() && toMouseEvent(*m_event).type() == EventTypeNames::click);
+ bool isTrustedOrClick = !RuntimeEnabledFeatures::trustedEventsDefaultActionEnabled() || m_event->isTrusted() || isClick;
// Call default event handlers. While the DOM does have a concept of preventing
// default handling, the detail of which handlers are called is an internal

Powered by Google App Engine
This is Rietveld 408576698