Gecko dispatches multiple FocusEvents if the focus stayed within the same ShadowRoot and there shouldn't be a change to document.activeElement. At least that's my interpretation of Shadow DOM 5.8 Event Dispatch: If the relatedTarget and target are the same for a given node, its the event listeners must not be invoked.

This issue may be related to wrong activeElement when focusing element in ShadowDOM and even more so to focus and blur events should have relatedTarget.

In Firefox the setting dom.webcomponents.enabled needs to be set to true to enable ShadowDOM support.