Commit 682a3df7 authored by Mounir Lamouri's avatar Mounir Lamouri Committed by Commit Bot

Media Controls: only eat keyboard inputs on popups when using them.

This allows shortcuts such as going to the dev tools to work while the
popup menus are visible.

Bug: 835615
Change-Id: Ie09bbe679c1356249138cf45c1b24977f7895158
Reviewed-on: https://chromium-review.googlesource.com/1023596Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Mounir Lamouri <mlamouri@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552719}
parent e9fdf22e
...@@ -59,6 +59,7 @@ class MediaControlPopupMenuElement::KeyboardEventListener final ...@@ -59,6 +59,7 @@ class MediaControlPopupMenuElement::KeyboardEventListener final
void handleEvent(ExecutionContext*, Event* event) final { void handleEvent(ExecutionContext*, Event* event) final {
if (event->type() == EventTypeNames::keydown && event->IsKeyboardEvent()) { if (event->type() == EventTypeNames::keydown && event->IsKeyboardEvent()) {
KeyboardEvent* keyboard_event = ToKeyboardEvent(event); KeyboardEvent* keyboard_event = ToKeyboardEvent(event);
bool handled = true;
switch (keyboard_event->keyCode()) { switch (keyboard_event->keyCode()) {
case VKEY_TAB: case VKEY_TAB:
...@@ -78,10 +79,14 @@ class MediaControlPopupMenuElement::KeyboardEventListener final ...@@ -78,10 +79,14 @@ class MediaControlPopupMenuElement::KeyboardEventListener final
case VKEY_SPACE: case VKEY_SPACE:
ToElement(event->target()->ToNode())->DispatchSimulatedClick(event); ToElement(event->target()->ToNode())->DispatchSimulatedClick(event);
break; break;
default:
handled = false;
} }
event->stopPropagation(); if (handled) {
event->SetDefaultHandled(); event->stopPropagation();
event->SetDefaultHandled();
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment