Skip to content
TheChatArchiveThe Chat Archive
xiaomi/mimo-v2.5-pro· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [Bug]: extension-table 3.23 TableView NodeView ignores HTMLAttributes…

  1. 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-table 3.23.x, configuring the Table extension with HTMLAttributes no longer applies those attributes to the rendered <table> element when resizable: 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. TableView existed byte-identical in 3.22.4, but the Table extension had no addNodeView() method, so ProseMirror always fell back to the schema's renderHTML. 3.23 added addNodeView() that wires the NodeView in, bypassing renderHTML.

    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 no class="my-custom-table".

    Browser Used

    Chrome

    Code Example URL

    https://codesandbox.io/p/devbox/laughing-glade-n4qh4r

    Expected Behavior

    The <table> element should render with class="my-custom-table" (the documented Table.configure HTMLAttributes behavior), regardless of the resizable setting.

    A minimal fix would have TableView apply this.options.HTMLAttributes to the inner <table> element in its constructor.

    Additional Context (Optional)

    Root cause

    3.23 introduced addNodeView() on the Table extension (extension-table dist/index.js around 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);
    }
    

    When resizable is false (default) and View is the default TableView, this returns a NodeView. TableView builds the DOM manually:

    constructor(node, cellMinWidth) {
      this.dom = document.createElement("div");
      this.dom.className = "tableWrapper";
      this.table = this.dom.appendChild(document.createElement("table"));
      if (node.attrs.style) {
        this.table.style.cssText = node.attrs.style;
      }
      this.colgroup = this.table.appendChild(document.createElement("colgroup"));
      updateColumns(node, this.colgroup, this.table, cellMinWidth);
      this.contentDOM = this.table.appendChild(document.createElement("tbody"));
    }
    

    TableView never reads this.options.HTMLAttributes. The schema-level renderHTML (which does call mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, ...)) is bypassed whenever the NodeView is active.

    Workaround

    Table.configure({
      HTMLAttributes: { class: 'my-custom-table' },
      View: null
    })
    

    This disables the NodeView and falls back to the schema's renderHTML. Side effect: loses TableView's in-place update(node) column-width sync; a full re-render happens on attribute changes instead. Acceptable for most read-only or non-resizable use cases.

    Related

    #6176 reports a similar symptom on Tiptap 2.11.5 with resizable: true. Different mechanism (no addNodeView in 2.x), same user-facing impact.

    Dependency Updates

    • Yes, I've updated all my dependencies.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /tiptap, current file: none) bash-$

  2. Assistant

    I'll start by exploring the repository structure to understand the codebase and locate the relevant files for the table extension. Let me first get an overview.

  3. Assistant

    Good, I can see there's a TableView.ts file. Let me examine that and the main table extension.

  4. Assistant

    Now let me look at the table extension file to understand how addNodeView is implemented.

  5. Assistant

    Let me see the full table.ts file to understand the addNodeView method:

  6. Assistant

    Let me see the full addNodeView method:

  7. Assistant

    Now let me look at the renderHTML method to understand how HTMLAttributes are applied in the schema path:

  8. Assistant

    Let me also check how TableView is used elsewhere and how columnResizing plugin uses it:

  9. Assistant

    Let me check how columnResizing from @tiptap/pm/tables uses the View option:

  10. Assistant

    Let me check the mergeAttributes utility from @tiptap/core:

  11. Assistant

    Let me check the test files for the table extension:

  12. Assistant

    Let me look at the colgroup update test since it's most relevant:

  13. Assistant

    Now I understand the issue. The TableView class doesn't receive or apply HTMLAttributes to the <table> element. When addNodeView() returns a TableView (non-resizable case), it bypasses renderHTML, so HTMLAttributes from Table.configure() are never applied.

    The fix is straightforward:

    1. Modify TableView to accept HTMLAttributes and apply them to the <table> element
    2. Modify addNodeView() to pass HTMLAttributes to View

    Let me also check the default options for Table:

  14. Assistant

    Now let me also check the columnResizing plugin path to understand how the View is used there:

  15. Assistant

    Now I understand the issue. The TableView class doesn't receive HTMLAttributes and therefore doesn't apply them. When addNodeView() returns a TableView, it bypasses the renderHTML which would normally apply them.

    Let me check how mergeAttributes works:

  16. Assistant

    Now I have a clear understanding of the issue. Let me implement the fix:

    1. TableView constructor needs to accept HTMLAttributes and apply them to the <table> element
    2. addNodeView() needs to pass this.options.HTMLAttributes when creating the View

    Let me also check the View type to see if I need to update it:

  17. Assistant

    Let me also check how the columnResizing plugin from prosemirror-tables uses the View parameter:

  18. Assistant

    Let me look at the prosemirror-tables source to see how it passes arguments to the View:

  19. Assistant

    Now I understand the full picture. Let me implement the fix. The approach:

    1. Modify TableView constructor to accept an optional HTMLAttributes parameter
    2. Apply HTMLAttributes to the <table> element using mergeAttributes
    3. Modify addNodeView() to pass this.options.HTMLAttributes to the View constructor
    4. Update the View type signature to accept the new parameter

    Let me first check the @tiptap/pm/tables package to see if it re-exports columnResizing:

  20. Assistant

    Now let me implement the fix. I'll modify TableView to accept HTMLAttributes and apply them to the <table> element, and update addNodeView() to pass them.

  21. Assistant

    Now I have a clear understanding. The fix needs to:

    1. Update TableView constructor to accept optional HTMLAttributes parameter
    2. Apply those HTMLAttributes to the <table> element
    3. Update addNodeView() to pass this.options.HTMLAttributes
    4. Update the View type to accept the new parameter

    Let me also check how other NodeViews apply attributes. Let me look at what setAttributes does in tiptap:

  22. Assistant

    Now let me implement the fix. I'll update both TableView and addNodeView():

  23. Assistant

    Let me open the file first, then edit it:

  24. Assistant

    Now I have a clear picture. The approach:

    1. Modify TableView constructor to accept an optional HTMLAttributes parameter
    2. Update addNodeView() to pass this.options.HTMLAttributes
    3. Also handle the resizable case where columnResizing creates views

    Let me also check how columnResizing is called to handle the resizable case:

  25. Assistant

    Now I have a complete understanding. Let me implement the fix. The approach:

    1. Modify TableView constructor to accept optional HTMLAttributes as 4th parameter (after view)
    2. Update addNodeView() to pass this.options.HTMLAttributes
    3. For the resizable case, wrap the View in addProseMirrorPlugins() to inject HTMLAttributes
  26. Assistant

    Let me use a different approach to edit the file:

  27. Assistant

    Let me use a heredoc to edit the file:

  28. Assistant

    Good, TableView is updated. Now I need to update addNodeView() in table.ts to pass this.options.HTMLAttributes to the View constructor. I also need to handle the resizable case where columnResizing creates its own View:

  29. Assistant

    Now let me update addNodeView() to pass this.options.HTMLAttributes:

  30. Assistant

    The edit command seems to be struggling with matching multi-line strings. Let me use the replace command instead.

  31. Assistant

    Let me use the special replace command syntax:

  32. Assistant

    Good, addNodeView() is updated. Now I also need to handle the resizable case. When resizable: true, the columnResizing plugin creates its own NodeView using View: this.options.View, and it only passes (node, cellMinWidth, view) — no HTMLAttributes. Let me also update addProseMirrorPlugins() to wrap the View:

  33. Assistant

    Now let me verify both files look correct:

  34. Assistant

    Good. Let me also verify the table.ts changes:

  35. Assistant

    Now let me run the existing tests to make sure nothing is broken:

  36. Assistant

    Let me check the package.json to understand how to run tests.

  37. Assistant

    Let me run the existing table tests to make sure they pass:

  38. Assistant

    Let me run just the table tests:

  39. Assistant

    All 34 existing tests pass. Now let me create a test script to verify the bug fix works correctly:

  40. Assistant

    Let me create a proper test using vitest (since jsdom is already configured):

  41. Assistant

    All 5 new tests pass. Let me also run all the existing table tests again to make sure nothing is broken:

  42. Assistant

    All 39 tests pass (34 existing + 5 new). Let me clean up the temporary test file as per the instructions (I shouldn't add tests to the repo):

  43. Assistant

    Let me verify the final state of my changes:

  44. Assistant

    Let me run the full test suite one more time to confirm everything is clean:

  45. Assistant

    All 34 existing tests pass. Let me verify the final file contents one more time:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.