Fix the condition to keep original logic

Address this PR comment: https://github.com/servo/servo/pull/24489/files#diff-30a18e04d7e0b66aafdf192e416cad44R1472
This commit was failed to add in PR #24489.

Issue: #22782
This commit is contained in:
takumi 2019-10-25 16:14:16 +09:00
parent 273fe590db
commit 3af931004f

View file

@ -1469,8 +1469,8 @@ impl Document {
// however *when* we do it is up to us.
// Here, we're 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
if (keyboard_event.key == Key::Enter && keyboard_event.state == KeyState::Up) ||
(keyboard_event.code == Code::Space && keyboard_event.state == KeyState::Down)
if (keyboard_event.key == Key::Enter || keyboard_event.code == Code::Space) &&
keyboard_event.state == KeyState::Up
{
let maybe_elem = target.downcast::<Element>();
if let Some(el) = maybe_elem {