Commit 7606f309 authored by Will Cassella's avatar Will Cassella Committed by Commit Bot

Hide text track list menu after selection is made

This sort of worked before since the logic to detect if any part of the list
was focused was broken, but that didn't work in the VRB so. This CL fixes that
logic and makes the menu close in a more direct way.

Bug: 865010
Change-Id: Ie6974404947380bb45c48c597b0b4a7830c68228
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1546725Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Will Cassella <cassew@google.com>
Cr-Commit-Position: refs/heads/master@{#646418}
parent 2ddec3ee
......@@ -214,11 +214,17 @@ void MediaControlPopupMenuElement::HideIfNotFocused() {
if (!IsWanted())
return;
if (!GetDocument().FocusedElement() ||
(GetDocument().FocusedElement()->parentElement() != this &&
GetDocument().FocusedElement() != this)) {
SetIsWanted(false);
// Cancel hiding if the focused element is a descendent of this element
auto* focused_element = GetDocument().FocusedElement();
while (focused_element) {
if (focused_element == this) {
return;
}
focused_element = focused_element->parentElement();
}
SetIsWanted(false);
}
// Focus the given item in the list if it is displayed. Returns whether it was
......
......@@ -100,6 +100,9 @@ void MediaControlTextTrackListElement::DefaultEventHandler(Event& event) {
MediaElement().DisableAutomaticTextTrackSelection();
}
// Close the text track list,
// since we don't support selecting multiple tracks
SetIsWanted(false);
event.SetDefaultHandled();
}
MediaControlPopupMenuElement::DefaultEventHandler(event);
......
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