ISSUE DESCRIPTION [Bug]: extension-table 3.23 TableView NodeView ignores HTMLAttributes…
- User
ISSUE DESCRIPTION
[Bug]: extension-table 3.23 TableView NodeView ignores HTMLAttributes (regression from 3.22.4)
Affected Packages
@tiptap/extension-table
Version(s)
3.23.1 (also 3.23.2, 3.23.4)
Bug Description
Summary
In
@tiptap/extension-table3.23.x, configuring the Table extension withHTMLAttributesno longer applies those attributes to the rendered<table>element whenresizable: false(the default). The class/attributes silently disappear from the DOM.This is a regression from 3.22.4, where the same configuration worked correctly.
TableViewexisted byte-identical in 3.22.4, but the Table extension had noaddNodeView()method, so ProseMirror always fell back to the schema'srenderHTML. 3.23 addedaddNodeView()that wires the NodeView in, bypassingrenderHTML.Reproduction
import { Editor } from '@tiptap/core'; import StarterKit from '@tiptap/starter-kit'; import { Table, TableRow, TableHeader, TableCell } from '@tiptap/extension-table'; new Editor({ extensions: [ StarterKit, Table.configure({ HTMLAttributes: { class: 'my-custom-table' } }), TableRow, TableHeader, TableCell ], content: '<table><tbody><tr><td>cell</td></tr></tbody></table>' });Inspect the rendered DOM. The
<table>element has noclass="my-custom-table".Browser Used
Chrome
Code Example URL
https://codesandbox.io/p/devbox/laughing-glade-n4qh4r
Expected Behavior
The
<table>element should render withclass="my-custom-table"(the documented Table.configure HTMLAttributes behavior), regardless of theresizablesetting.A minimal fix would have
TableViewapplythis.options.HTMLAttributesto the inner<table>element in its constructor.Additional Context (Optional)
Root cause
3.23 introduced
addNodeView()on the Table extension (extension-tabledist/index.jsaround line 645):addNodeView() { const isResizable = this.options.resizable && this.editor.isEditable; const View = this.options.View; if (isResizable || !View) { return null; } return ({ node, view }) => new View(node, this.options.cellMinWidth, view); } - Assistant
I'll start by exploring the repository structure and locating the Table extension / TableView code related to the HTMLAttributes regression.
- Assistant
Let me look at the TableView and related source files.
- Assistant
Let me read the TableView.ts and table.ts files.
- Assistant
I'll open the rest of TableView.ts and check how columnResizing uses the View.
- Assistant
Next I'll inspect how the Table extension defines attributes and how
mergeAttributesis used. - Assistant
Let me look at how prosemirror-tables uses the View and also check git history for recent changes. Also look at mergeAttributes and getRenderedAttributes.
- Assistant
Let me look at how columnResizing uses View in prosemirror-tables, and also check if there's existing code that applies HTML attributes to node views elsewhere.
- Assistant
Let me check how prosemirror-tables uses the View constructor.
- Assistant
Let me look at the prosemirror TableView and how tiptap's TableView compares. Also check the d2ad165b7 fixed commit for context.
- Assistant
There's a similar fix for TaskItem retaining HTML attributes — I'll inspect that pattern.
- Assistant
Inspecting TaskItem's NodeView for how it applies HTMLAttributes.
- Assistant
Checking how Tiptap's NodeViewRenderer supplies props and whether HTMLAttributes are included.
- Assistant
Checking Table node attributes and related tests for expected behavior.
- Assistant
Checking how table style attributes are defined and reviewingProjectile existing patterns for wrapping Views.
- Assistant
I’ll check the style-related table commit and how tests are run.
- Assistant
Checking contribution guidelines and whether a changeset is required.
- Assistant
Implementing the fix: updating
TableViewto applyHTMLAttributes, and wiring them through from the Table extension. - Assistant
Updating
table.tsto passHTMLAttributesinto the View, and fixing style merging so option styles aren't wiped out. - Assistant
Let me update the View type and the addProseMirrorPlugins and addNodeView methods.
- Assistant
Now update addProseMirrorPlugins and addNodeView.
- Assistant
I'll create a helper function to wrap the View so HTMLAttributes are always passed, and use it in both places.
- Assistant
Adding the
createTableViewConstructorhelper next. - Assistant
I'll add the helper before the Table export.
- Assistant
Fixing View capture and style merging in the constructor wrap.
- Assistant
Improving style merging so option
styleandnode.attrs.stylecombine correctly. - Assistant
I'll refine the style application to merge properly by applying style properties.ncbi Using cssText combination is simple enough.
- Assistant
Updating
addNodeViewto merge static salto and dynamic rendered attributes, matching the TaskItem pattern. - Assistant
That edit landed in the wrong file — reverting
TableView.tsand applying the change totable.ts. - Assistant
TableView looks good again. Updating
addNodeViewintable.tsnext. - Assistant
The file structure got corrupted — I'll read the end of the file and restore it.
- Assistant
I'll replace the broken section from lines 533–573 with the correct version.
- Assistant
The file looks correct. Verifying structure and running a reproduction test.
- Assistant
Fixing the trailing newline and checking how tests resolve packages.
- Assistant
Let me try differently.
- Assistant
No python3? Let me try node.
- Assistant
Tests resolve source directly. Fixing the missing newline, then writing a temporary reproduction script.
- Assistant
History expansion broke the heredoc — writing the test file with Node instead.
- Assistant
Putting the temp test under packages so Vitest picks it up.
- Assistant
The command timed out. Let me try again with a longer approach - maybe pnpm is slow.
- Assistant
Vitest timed out — checking whether the process is hung and trying a different run approach.
- Assistant
Running via
nodeworks better — executing our temp test that way. - Assistant
Both cases pass. Running the existing table tests and removing the temporary file.
- Assistant
All tests passed. Running a quick syntax/lint check and collecting a brief final review.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.