Skip to content

Instantly share code, notes, and snippets.

@dbaron
Created March 6, 2026 15:38
Show Gist options
  • Select an option

  • Save dbaron/8ce9dfe1a6a00a166b82dd734429f8b8 to your computer and use it in GitHub Desktop.

Select an option

Save dbaron/8ce9dfe1a6a00a166b82dd734429f8b8 to your computer and use it in GitHub Desktop.
Document::PopoverStack& popover_auto_stack = document.PopoverAutoStack();
auto submenu_it = std::ranges::find(popover_auto_stack, sub_menu_);
if (submenu_it == popover_auto_stack.end()) {
// Our submenu is no longer open.
Finish();
return;
}
if (std::ranges::any_of(
base::span(submenu_it, popover_auto_stack.end()).subspan<1>(),
[](HTMLElement* e) -> bool { return IsA<HTMLMenuListElement>(e); })) {
// There is another menu open, on top of our submenu in the popover stack.
// The innermost submenu is the only one that should have a safe triangle.
Finish();
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment