BookStackApp/BookStack · error · Error
No root element.
Error message
No root element.
What it means
Internal sanity guard in Lexical's applyTableHandlers: the editor's root DOM element (editor.getRootElement()) is null when table selection handlers are being attached, meaning the table registration ran against an editor that is not yet (or no longer) attached to a DOM element.
Source
Thrown at resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts:97
export const getDOMSelection = (
targetWindow: Window | null,
): Selection | null =>
CAN_USE_DOM ? (targetWindow || window).getSelection() : null;
const isMouseDownOnEvent = (event: MouseEvent) => {
return (event.buttons & 1) === 1;
};
export function applyTableHandlers(
tableNode: TableNode,
tableElement: HTMLTableElementWithWithTableSelectionState,
editor: LexicalEditor,
hasTabHandler: boolean,
): TableObserver {
const rootElement = editor.getRootElement();
if (rootElement === null) {
throw new Error('No root element.');
}
const tableObserver = new TableObserver(editor, tableNode.getKey());
const editorWindow = editor._window || window;
attachTableObserverToTableElement(tableElement, tableObserver);
const createMouseHandlers = () => {
const onMouseUp = () => {
tableObserver.isSelecting = false;
editorWindow.removeEventListener('mouseup', onMouseUp);
editorWindow.removeEventListener('mousemove', onMouseMove);
};
const onMouseMove = (moveEvent: MouseEvent) => {
// delaying mousemove handler to allow selectionchange handler from LexicalEvents.ts to be executed first
setTimeout(() => {
if (!isMouseDownOnEvent(moveEvent) && tableObserver.isSelecting) {View on GitHub (pinned to 18f8469a1c)
Solutions
- Ensure applyTableHandlers/tableSelection is only called after the editor is mounted with a root element
- Check the editor has not been torn down before the table plugin initializes
- Verify the editor container element exists in the DOM at plugin setup time
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at resources/js/wysiwyg/lexical/table/LexicalTableSelectionHelpers.ts:97 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/80eff96258c6d0f7.
Report an issue: GitHub.