What this compares
Both frames are built from the same BlockNote source and the same two-paragraph fixture. Before is the unmodified baseline; After can be switched between the combined patch and each isolated file. This shows which change fixes focus and which fixes activation.
The problem
With the side menu showing and the caret in a block, Tab can focus a cloned Add block button from the closing transition. That copy has no React handlers; Enter and Space do nothing, and about 250 ms later it is removed and focus falls to the document body. The live Add block button also ignores Enter and Space because its click handler is on the icon.
Important: the static build does not emulate forced colours or CDP media preferences. Use the local Diff Lab for forced-colours light/dark, reduced motion, capture and controlled Chromium. The theme buttons here force the editor’s Mantine theme; they do not claim to reproduce OS contrast themes.
What differs in the built editor
diff --git a/packages/react/src/components/Popovers/GenericPopover.tsx b/packages/react/src/components/Popovers/GenericPopover.tsx
index 2eb5808..80ab35b 100644
--- a/packages/react/src/components/Popovers/GenericPopover.tsx
+++ b/packages/react/src/components/Popovers/GenericPopover.tsx
@@ -235,13 +235,19 @@ export const GenericPopover = (
return;
}
+ const wrapper = ref.current;
+ // The snapshot is only for the closing transition. It must never become
+ // a tab stop after the live popover has closed: Tab can otherwise focus
+ // a button inside the copy, which is then removed and drops focus.
+ wrapper.setAttribute("inert", "");
const nodes = [...snapshot.current];
- ref.current.append(...nodes);
+ wrapper.append(...nodes);
return () => {
for (const node of nodes) {
node.parentNode?.removeChild(node);
}
+ wrapper.removeAttribute("inert");
};
}, [status]);
diff --git a/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx b/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx
index ac1209f..26fc8bc 100644
--- a/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx
+++ b/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx
@@ -55,9 +55,8 @@ export const AddBlockButton = () => {
<Components.SideMenu.Button
className={"bn-button"}
label={dict.side_menu.add_block_label}
- icon={
- <AiOutlinePlus size={24} onClick={onClick} data-test="dragHandleAdd" />
- }
+ onClick={onClick}
+ icon={<AiOutlinePlus size={24} data-test="dragHandleAdd" />}
/>
);
};
diff --git a/packages/react/src/components/Popovers/GenericPopover.tsx b/packages/react/src/components/Popovers/GenericPopover.tsx
index 2eb5808..80ab35b 100644
--- a/packages/react/src/components/Popovers/GenericPopover.tsx
+++ b/packages/react/src/components/Popovers/GenericPopover.tsx
@@ -235,13 +235,19 @@ export const GenericPopover = (
return;
}
+ const wrapper = ref.current;
+ // The snapshot is only for the closing transition. It must never become
+ // a tab stop after the live popover has closed: Tab can otherwise focus
+ // a button inside the copy, which is then removed and drops focus.
+ wrapper.setAttribute("inert", "");
const nodes = [...snapshot.current];
- ref.current.append(...nodes);
+ wrapper.append(...nodes);
return () => {
for (const node of nodes) {
node.parentNode?.removeChild(node);
}
+ wrapper.removeAttribute("inert");
};
}, [status]);
diff --git a/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx b/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx
index ac1209f..26fc8bc 100644
--- a/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx
+++ b/packages/react/src/components/SideMenu/DefaultButtons/AddBlockButton.tsx
@@ -55,9 +55,8 @@ export const AddBlockButton = () => {
<Components.SideMenu.Button
className={"bn-button"}
label={dict.side_menu.add_block_label}
- icon={
- <AiOutlinePlus size={24} onClick={onClick} data-test="dragHandleAdd" />
- }
+ onClick={onClick}
+ icon={<AiOutlinePlus size={24} data-test="dragHandleAdd" />}
/>
);
};
Patch for this PR
Limits and provenance
- Even “both fixes” is partial: it prevents focus loss and fixes activation, but the side menu is still only revealed by pointer hover. Keyboard-only discovery needs a maintainer decision.
- Only the default Mantine UI and Chromium were exercised. Ariakit, shadcn, Firefox and Safari are unverified; no human screen-reader session was recorded.
- The proposed upstream regression test is in the repository but has not been run because BlockNote requires its browser suite to run in Docker.
- Static bundles are prebuilt from upstream
9cb988ff94b60979bbbc62b0ded5cf62fdac88c8plus local fixture4611ae1band committed topages/before,pages/after,pages/after-inertandpages/after-activation; the Pages workflow assembles the page but does not rebuild BlockNote. BlockNote remains MPL-2.0; see LICENSE-BlockNote.txt. - No upstream BlockNote PR was opened. This is a local experimental comparison, not a conformance claim.