Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return `KeyReaction::Nothing` for a Tab event #14184

Merged
merged 1 commit into from Nov 12, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Return `KeyReaction::Nothing` for a Tab event

Hitting the tab key in an html text input shouldn't submit the form, and
for any text input, the tab key should have a particular action
associated, not the default action. This cleans up #12701.
  • Loading branch information
jmcomets committed Nov 12, 2016
commit 319153640ca11a386df944dafc45ab1f18192534
@@ -35,7 +35,6 @@ use dom::virtualmethods::VirtualMethods;
use html5ever_atoms::LocalName;
use ipc_channel::ipc::{self, IpcSender};
use mime_guess;
use msg::constellation_msg::Key;
use net_traits::{CoreResourceMsg, IpcSend};
use net_traits::blob_url_store::get_blob_origin;
use net_traits::filemanager_thread::{FileManagerThreadMsg, FilterPattern};
@@ -1097,18 +1096,10 @@ impl VirtualMethods for HTMLInputElement {
let action = self.textinput.borrow_mut().handle_keydown(keyevent);
match action {
TriggerDefaultAction => {
if let Some(key) = keyevent.get_key() {
match key {
Key::Enter | Key::KpEnter =>
self.implicit_submission(keyevent.CtrlKey(),
keyevent.ShiftKey(),
keyevent.AltKey(),
keyevent.MetaKey()),
// Issue #12071: Tab should not submit forms
// TODO(3982): Implement form keyboard navigation
_ => (),
}
};
self.implicit_submission(keyevent.CtrlKey(),
keyevent.ShiftKey(),
keyevent.AltKey(),
keyevent.MetaKey());
},
DispatchInput => {
self.value_changed.set(true);
@@ -544,7 +544,6 @@ impl<T: ClipboardProvider> TextInput<T> {
self.adjust_vertical(28, maybe_select);
KeyReaction::RedrawSelection
}
(None, Key::Tab) => KeyReaction::TriggerDefaultAction,
_ => KeyReaction::Nothing,
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.