mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Implement implicit form submission
This commit is contained in:
parent
c89ec3910f
commit
6482e313d6
3 changed files with 24 additions and 3 deletions
|
@ -915,11 +915,14 @@ impl ScriptTask {
|
|||
// I'm dispatching it after the key event so the script has a chance to cancel it
|
||||
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=27337
|
||||
match key {
|
||||
Key::KeySpace | Key::KeyEnter if !prevented && state == Released => {
|
||||
// TODO handle space and enter slightly differently
|
||||
Key::KeySpace if !prevented && state == Released => {
|
||||
let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target);
|
||||
maybe_elem.map(|el| el.as_maybe_activatable().map(|a| a.synthetic_click_activation(ctrl, alt, shift, meta)));
|
||||
}
|
||||
Key::KeyEnter if !prevented && state == Released => {
|
||||
let maybe_elem: Option<JSRef<Element>> = ElementCast::to_ref(target);
|
||||
maybe_elem.map(|el| el.as_maybe_activatable().map(|a| a.implicit_submission(ctrl, alt, shift, meta)));
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
window.flush_layout();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue