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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/keypress-focus-change.html

Issue 2628763003: Keyboard event should not insert a character at selection if selection doesn't have focus (Closed)
Patch Set: 2017-01-12T13:25:32 Created 3 years, 11 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
OLDNEW
1 <html> 1 <html>
2 <script> 2 <script>
3 function log(msg) { 3 function log(msg) {
4 var res = document.getElementById('res'); 4 var res = document.getElementById('res');
5 res.innerHTML = res.innerHTML + msg + "<br>"; 5 res.innerHTML = res.innerHTML + msg + "<br>";
6 } 6 }
7 function test() { 7 function test() {
8 var tf0 = document.getElementById('tf0'); 8 var tf0 = document.getElementById('tf0');
9 var fr = document.getElementById('fr'); 9 var fr = document.getElementById('fr');
10 var tf1 = fr.contentDocument.getElementById('tf1'); 10 var tf1 = fr.contentDocument.getElementById('tf1');
11 tf0.focus(); 11 tf0.focus();
12 if (window.testRunner) { 12 if (window.testRunner) {
13 testRunner.dumpAsText(); 13 testRunner.dumpAsText();
14 eventSender.keyDown("1"); 14 eventSender.keyDown("1");
15 eventSender.keyDown("2"); 15 eventSender.keyDown("2");
16 eventSender.keyDown("3"); 16 eventSender.keyDown("3");
17 } 17 }
18 if (tf0.value == "1" && tf1.value == "23") { 18 if (tf0.value == "" && tf1.value == "23") {
19 res.innerHTML = "Test Passed"; 19 res.innerHTML = "Test Passed";
20 } else { 20 } else {
21 res.innerHTML = "Test Failed: first field = " + tf0.value + " secon d field = " + tf1.value; 21 res.innerHTML = "Test Failed: first field = " + tf0.value + " secon d field = " + tf1.value;
22 } 22 }
23 } 23 }
24 24
25 </script> 25 </script>
26 <body onload="test()"> 26 <body onload="test()">
27 This tests that when the keyPress event handler changes focus to a new form field,<br> 27 This tests that when the keyPress event handler changes focus to a new form field,<br>
28 that the key will still be inserted in the original field that was the targe t of the event.<br> 28 that the key will not be inserted in the original field that was the target of the event.<br>
29 Note: Edge will not inserted. Firefox and WebKit will insert.
29 <input id="tf0" onkeypress="document.getElementById('fr').contentDocument.ge tElementById('tf1').focus();"> 30 <input id="tf0" onkeypress="document.getElementById('fr').contentDocument.ge tElementById('tf1').focus();">
30 <iframe id="fr" style="border: solid thin black;" src="resources/keypress-fr ame.html"></iframe> 31 <iframe id="fr" style="border: solid thin black;" src="resources/keypress-fr ame.html"></iframe>
31 <br> 32 <br>
32 <div id="res"></div> 33 <div id="res"></div>
33 </body> 34 </body>
34 </html> 35 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698