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

Side by Side Diff: LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link.html

Issue 619613005: The link should be activated by enter key on focusing the child element inside the anchor(relanding) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <a id="link" href="#" tabindex="-1" onclick="debug(eventInfo(event))">
4 <h1 tabindex="1" id="focus0"
5 onkeydown="debug(eventInfo(event))"
6 onkeypress="debug(eventInfo(event))"
7 onkeyup="debug(eventInfo(event))">EnterMe</h1>
8 <textarea tabindex="2" id="focus1"
9 onkeydown="debug(eventInfo(event))"
10 onkeypress="debug(eventInfo(event))"
11 onkeyup="debug(eventInfo(event))">TypeHere</textarea>
12 </a>
13 <svg width="200" height="50" onclick="debug(eventInfo(event))">>
robwu 2014/10/13 21:57:04 Remove the trailing >.
14 <a xlink:href="#">
15 <text font-size="18px" y="20" tabindex="3"
16 onkeydown="debug(eventInfo(event))"
17 onkeypress="debug(eventInfo(event))"
18 onkeyup="debug(eventInfo(event))">SVG anchor with tabindex</text>
19 </a>
20 </svg>
21 <div id="console"></div>
22 <script>
23 description('This test ensures that the link is activated by enter key on fo cusing the child element inside the anchor');
24
25 function test(eventType) {
robwu 2014/10/13 21:57:04 Next time, please choose a more descriptive name t
26 var event = document.createEvent('KeyboardEvents');
27 event.initKeyboardEvent(eventType, true, true, window, 'Enter', 0, 0, 0, 0, 0, false);
28 document.activeElement.dispatchEvent(event);
29 }
30 function eventInfo(event) {
31 target = event.srcElement ? event.srcElement : event.target;
robwu 2014/10/13 21:57:04 `srcElement` is a non-standard property and only n
32 if (event.type == "keydown" || event.type == "keypress" || event.type == "keyup")
robwu 2014/10/13 21:57:04 Nit: Try to be consistent with quotes. Either use
33 return event.keyIdentifier == "U+0009" ? "" : target.tagName + " - " + event.type + ' - ' + event.keyIdentifier;
34 else if (event.type == "click")
35 return target.tagName + " - " + event.type;
36 else
37 return "unexpected event - " + target.tagName + " - " + event.type;
38
39 }
40 if (window.eventSender)
41 eventSender.keyDown("\t");
42 test('keydown');
43 test('keypress');
44 test('keyup');
45 if (window.eventSender) {
46 eventSender.keyDown("\t");
47 eventSender.keyDown("\n");
48 eventSender.keyDown("\t");
49 }
50 test('keydown');
51 test('keypress');
52 test('keyup');
53 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/press-enter-key-on-focused-element-inside-link-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698