thoughtbot/capybara-webkit — Issue #272: Keypress event contains invalid charCode
Author: ryanfields
Created: 2012-02-15 01:33:49+00:00
State: open

I'm not sure if capybara-webkit is to blame for this, or if the issue lies within QtWebKit. When I fill in a form field, my event handlers receive keypress events with what appear to be strings in the charCode property, rather than a proper ASCII code.

For example, if I just fill_in with "a", the resulting event.charCode is 'a' and event.keyCode is 0. In Chrome/Safari, charCode is 97 and keyCode is 97.

This breaks my event handlers in testing, because they have the expectation that the "browser" will send ASCII codes. Instead of translating 97 to lowercase 'a', they try to translate 'a' and end up with garbage. As a result, tests fail in capybara-webkit that otherwise succeed if run in the major browsers.