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

Unified Diff: third_party/WebKit/LayoutTests/accessibility/image-inside-link.html

Issue 2043433002: Make click targets inside links work. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/accessibility/image-inside-link.html
diff --git a/third_party/WebKit/LayoutTests/accessibility/image-inside-link.html b/third_party/WebKit/LayoutTests/accessibility/image-inside-link.html
new file mode 100644
index 0000000000000000000000000000000000000000..4f6dcf172cd73cae48c6842cb66e55802f7367db
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/accessibility/image-inside-link.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+
+<div id="wrapper1">
+ <a href="#"><img id="img1" alt="Delicious cake" src="resources/cake.png"></a>
+</div>
+
+<script>
+async_test(function(t)
+{
+ var axImg = accessibilityController.accessibleElementById("img1");
+ axImg.addNotificationListener(function(notification) {
+ if (notification == 'Clicked') {
+ document.getElementById("wrapper1").style.display = "none";
+ t.done();
+ }
+ });
+
+ var img = document.getElementById("img1");
+ img.addEventListener("click", function(e)
+ {
+ img.title = "clicked";
+ });
+ img.click();
+}, "clicking an image via javascript sends an accessible click event");
+</script>
+
+<div id="wrapper2">
+ <a href="#"><img id="img2" alt="Delicious cake" src="resources/cake.png"></a>
+</div>
+
+<script>
+async_test(function(t)
+{
+ var axEvent = false;
+ var domEvent = false;
+ var clickEventHandler = function(e)
+ {
+ if (e == 'Clicked')
+ axEvent = true;
+
+ // "which" is a known property on MouseEvent objects.
+ if (e.which) {
+ img.title = "clicked";
+ domEvent = true;
+ }
+
+ if (axEvent && domEvent) {
+ document.getElementById("wrapper2").style.display = "none";
+ t.done();
+ }
+ };
+
+ var axImg = accessibilityController.accessibleElementById("img2");
+ axImg.addNotificationListener(clickEventHandler);
+ var img = document.getElementById("img2");
+ img.addEventListener("click", clickEventHandler);
+ axImg.press();
+}, "clicking an image via accessibility sends both an accessible and a DOM click event");
+</script>
+
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/accessibility/AXNodeObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698