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
tsimport { 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 element in its constructor. - Assistant
I'll start by exploring the repository structure and locating the Table extension / TableView code related to the HTMLAttributes regression.
- Assistant
Next I'll inspect the Table extension source and TableView implementation for how HTMLAttributes are handled.
- Assistant
Let me read the TableView.ts and the relevant parts of table.ts.
- Assistant
Let me see the rest of the file and the table.ts addNodeView
- Assistant
Let me read the full table.ts relevant sections - addNodeView and renderHTML.
- Assistant
Let me also read addNodeView and types
- Assistant
I'll check how columnResizing instantiates the View and whether mergeAttributes is used similarly elsewhere.
- Assistant
Let me find how columnResizing creates the NodeView
- Assistant
Let me look at the columnResizing View instantiation
- Assistant
So columnResizing creates View as
new View(node, defaultCellMinWidth, view). The signature is fixed for when View is used via columnResizing plugin. - Assistant
Looking at how other NodeViews in tiptap apply HTMLAttributes - let me check for a pattern.
- Assistant
Let me look at how NodeView computes HTMLAttributes and how addNodeView typically works. Also check the existing tests.
- Assistant
I'll check how standard NodeView props include HTMLAttributes.
- Assistant
Important! Looking at ExtensionManager - when it calls the NodeView renderer, it passes HTMLAttributes as only
getRenderedAttributes(node, extensionAttributes)- NOT including options.HTMLAttributes... - Assistant
I'll check the table attribute definitions and existing issues related to HTMLAttributes.
- Assistant
Looking at attributes work for Table - does the table node have a style attribute defined?
- Assistant
Let me also look at how attributes are applied in similar NodeViews and what helper might set DOM attrs.
- Assistant
There's a pattern in extension-image!
- Assistant
I'll check how tests import the package and whether we need to rebuild dist.
- Assistant
Implementing the fix: update
TableViewto applyHTMLAttributes, and pass them from both the NodeView and columnResizing paths. - Assistant
Now updating
table.tsto pass HTMLAttributes through both the NodeView and columnResizing paths. - Assistant
Let me update the View type and the addProseMirrorPlugins and addNodeView methods.
- Assistant
Now update addProseMirrorPlugins and addNodeView.
- Assistant
I need to navigate to that line first. Also my replacement was messy with a half-baked class. Let me clean it up.
- Assistant
I'll use a clean factory approach and apply a careful edit.
- Assistant
There's a garbled comment with Cyrillic characters. Let me fix that.
- Assistant
Improving the resizable path so rendered node attributes are also applied, and cleaning up the blank line.
- Assistant
Cleaning up corrupted characters in that section.
- Assistant
Verifying the files look clean, then writing a temporary reproduction script.
- Assistant
Creating a temporary reproduction script to verify the fix works.
- Assistant
I'll write the test file with Node instead.
- Assistant
Let me verify the file and run it with vitest.
- Assistant
Vitest timed out earlier — I'll retry the tests on their own.
- Assistant
Let me run vitest
- Assistant
Vitest seems to hang. Maybe pnpm is doing something. Let me try npx-vitest or check if something works.
- Assistant
Even the existing tests hang. Maybe vitest needs something special. Let me try running with node directly and more debugging.
- Assistant
Using pool=threads works. The default forks pool might hang. Let me run our temp test.
- Assistant
All three tests passed. Running the full extension-table suite and removing the temporary test file.
- Assistant
All table tests passed. Checking formatting/lint and reviewing the full diff.
- Assistant
pnpm hit a corepack prompt — running oxfmt via the local binary instead.
- Assistant
I'll quickly confirm the bug on the original code before finalizing the fix.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.