entually_blurred(t, button);
    assert_equals(document.activeElement, document.body);
}, "when reparenting a focused element into a hidden parent, reset the document focus");

promise_test(async t => {
    const old_parent = document.querySelector("#old_parent");
    const button = document.querySelector("#button");
    t.add_cleanup(() => document.body.append(old_parent));
    const hidden_parent = document.querySelector("#hidden_parent");
    button.focus();
    assert_equals(document.activeElement, butt