My favorites | Sign in
Project Home Downloads Wiki Issues Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 160471: Javascript generated backspace key cause browser to execute "Back" command.
7 people starred this issue and may be notified of changes. Back to list
Status:  Untriaged
Owner:  ----


Sign in to add a comment
 
Reported by danrze...@gmail.com, Nov 11, 2012
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11

Steps to reproduce the problem:
Programmatically generating a backspace keydown event in javascript and sending it to an text input field will cause the browser to go back to the previous page.

What is the expected behavior?
The event would not bubble up to the browser and execute the keypress. No other program generated key presses bubble up to the browser and execute the standard behavior. For example, generating a Control+F command will not cause the browser to go into "Find" mode.

What went wrong?
The event bubbled up to the browser.

Did this work before? N/A 

Chrome version: 23.0.1271.64  Channel: stable
OS Version: OS X 10.8.2

Here is a sample html file which will reproduce the issue.

<!DOCTYPE html>
<html>
<head>
  <title>Backspace Issue</title>
  <script type="text/javascript">
    function press(event) {
      var evt = document.createEvent("KeyboardEvent");
      evt.initKeyboardEvent("keydown", true, true, null, "U+0008", 0, "")
      document.querySelector("#textfield").dispatchEvent(evt)
    }
  </script>
</head>
<body>
  <input type="text" id="textfield"/>
  <button onclick="press(event)">Press Me</button>
</body>
</html>

Just press the button and the page will go "Back" (assuming there is a page in history to go back to).
Nov 13, 2012
#1 athi...@chromium.org
This is reproducible in 21.0.1180.89, 22.0.1229.96 and 23.0.1271.64 on Windows 7.
Not a regression
Status: Untriaged
Labels: -Pri-2 -OS-Mac Pri-1 OS-All
Nov 13, 2012
#2 athi...@chromium.org
Also reproducible in 25.0.1324.0 (Official Build 167303) canary
Labels: Mstone-25
Nov 13, 2012
#3 athi...@chromium.org
(No comment was entered for this change.)
Labels: -Mstone-25 Mstone-23 Area-WebKit WebKit-JavaScript
Mar 10, 2013
#4 bugdro...@chromium.org
(No comment was entered for this change.)
Labels: -Mstone-23 -Area-WebKit -WebKit-JavaScript Cr-Content Cr-Content-JavaScript M-23
Apr 5, 2013
#5 bugdro...@chromium.org
(No comment was entered for this change.)
Labels: -Cr-Content Cr-Blink
Apr 5, 2013
#6 bugdro...@chromium.org
(No comment was entered for this change.)
Labels: -Cr-Content-JavaScript Cr-Blink-JavaScript
Sep 6, 2013
#7 kenjibaheux@chromium.org
Repro on M31 windows.
Note: on Chrome OS (29) nothing happens at all (no backspacing, no history back).
Sign in to add a comment

Powered by Google Project Hosting