On macOS, when a tab is switched away via keyboard shortcut
(Ctrl+Tab / Cmd+Opt+Arrow), the page does not
receive a mouse-leave event. An element that was hovered keeps its
:hover styling when you later click the tab to reactivate it.
The fix (CL 8309055)
clears hover/active state in Document::DidChangeVisibilityState()
when the page becomes hidden.
HOVERED.Ctrl+Tab to switch to tab B.Broken the box is still amber / HOVERED even though the mouse is elsewhere.
Fixed the box is back to not hovered.
Hover is tracked with mouseenter/mouseleave
listeners, not by querying :hover at hidden-time. The fix
clears hover state before dispatching visibilitychange,
so on a patched build matches(':hover') is already false inside
the hidden handler; mouse-event tracking is immune to that ordering.
After the tab becomes visible again, each previously hovered box is checked two ways:
element.matches(':hover') - Blink's hover flag:hover style is actually appliedFAIL internal still hovered (unpatched behavior). MIXED internal cleared but style still applied (hover flag cleared without effective style invalidation - fix incomplete). PASS both cleared.
Note: if you switch back with Ctrl+Tab and the mouse happens to
rest over a box, that box is legitimately hovered again -- use the tab-strip
click from the repro steps for a clean result.