diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-11-12 09:58:29 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-12 09:58:29 -0600 |
commit | f04033a13972faea9efd9689e6949406241ca85f (patch) | |
tree | d0e2da1e32ee2b28d06e63617cf790092261d038 | |
parent | 579ab2d99cd8c07a31c3b68a4659c484d5189ada (diff) | |
parent | 319153640ca11a386df944dafc45ab1f18192534 (diff) | |
download | servo-f04033a13972faea9efd9689e6949406241ca85f.tar.gz servo-f04033a13972faea9efd9689e6949406241ca85f.zip |
Auto merge of #14184 - jmcomets:tab-no-default-action, r=metajack
Return `KeyReaction::Nothing` for a Tab event
Do nothing instead of triggering the default action 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.
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14184)
<!-- Reviewable:end -->
-rw-r--r-- | components/script/dom/htmlinputelement.rs | 17 | ||||
-rw-r--r-- | components/script/textinput.rs | 1 |
2 files changed, 4 insertions, 14 deletions
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index b599d4369dc..ddbd57d2438 100644 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -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); diff --git a/components/script/textinput.rs b/components/script/textinput.rs index 25243d739ab..5f04b5b187e 100644 --- a/components/script/textinput.rs +++ b/components/script/textinput.rs @@ -544,7 +544,6 @@ impl<T: ClipboardProvider> TextInput<T> { self.adjust_vertical(28, maybe_select); KeyReaction::RedrawSelection } - (None, Key::Tab) => KeyReaction::TriggerDefaultAction, _ => KeyReaction::Nothing, } } |