Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging 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. DeepSeek Assistant

    Let me start by understanding the repository structure and the issue. The bug is about @tiptap/extension-table where HTMLAttributes configured on the Table extension are not applied to the rendered <table> element when resizable: false (default). The fix should be in TableView to apply this.options.HTMLAttributes to the inner <table> element.

    Let me explore the repository structure first.

  3. DeepSeek Assistant

    Let's find the extension-table package and look at the relevant files.

  4. DeepSeek Assistant

    Let's look at the structure of the extension-table package.

  5. DeepSeek Assistant

    Let me look at the table directory and the TableView file.

  6. DeepSeek Assistant

    Let me read the key files.

  7. DeepSeek Assistant

    Let me read them one at a time.

  8. DeepSeek Assistant

    Now let's look at the table.ts file:

  9. DeepSeek Assistant

    Now let me look at the dist files to confirm the issue and understand the build output

  10. DeepSeek Assistant

    Let me check the index file and understand the exports:

  11. DeepSeek Assistant

    Let me find and check any test files for the table extension

  12. DeepSeek Assistant

    Let me check the test files to understand the testing patterns

  13. DeepSeek Assistant

    Let me first try to reproduce the issue by creating a test script.

  14. DeepSeek Assistant

    Let me check how to run the tests:

  15. DeepSeek Assistant

    Let me see the full table.ts file, especially the renderHTML part

  16. DeepSeek Assistant

    Let me see the relevant section of table.ts around renderHTML and `addNode

  17. DeepSeek Assistant

    Let me check how columnResizing uses the View option

  18. DeepSeek Assistant

    Let me look at the node_modules for the pm tables package

  19. DeepSeek Assistant

    Let me check if there's a source for pm in the packages directory.

  20. DeepSeek Assistant

    Let me check the pm tables source

  21. DeepSeek Assistant

    Now I have a clear understanding. Let me create a reproduction script to confirm the bug:

  22. DeepSeek Assistant

    Now let me run it:

  23. DeepSeek Assistant

    We need a DOM environment. Let me use vitest directly to run a quick

  24. DeepSeek Assistant

    Let me create a simple reproduction test and run it with vitest:

  25. DeepSeek Assistant

    Now let's run this test.

  26. DeepSeek Assistant

    Let me put the test inside the extension-table test

  27. DeepSeek Assistant

    Now let me run this specific test to confirm the bug:

  28. DeepSeek Assistant

    The bug is confirmed. Now let me fix it. The issue is clear: TableView constructor builds the DOM manually but never applies HTMLAttributes. Let me fix both files

  29. DeepSeek Assistant

    Let me use the correct format for the open command.

  30. DeepSeek Assistant

    Let me see the rest of the file

  31. DeepSeek Assistant

    Now I understand the full picture. Let me fix both files. First, let me edit the TableView.ts to accept and apply HTMLAttributes:

  32. DeepSeek Assistant

    Now let me edit table.ts to pass HTMLAttributes to the View constructor:

  33. DeepSeek Assistant

    Let me go to the `addNodeView

  34. DeepSeek Assistant

    Now let me edit the addNodeView method to pass HTMLAttributes:

  35. DeepSeek Assistant

    Now let me run the reproduction test to confirm the fix works:

  36. DeepSeek Assistant

    The fix works. Now let me run the existing tests to make sure I didn't break anything:

  37. DeepSeek Assistant

    All 35 tests pass (including the new reproduction test). Now let me remove the test file I added (since the instructions say not to add new tests) and verify the final state:

  38. DeepSeek Assistant

    Let me verify the existing tests still pass after removing the repro test:

  39. DeepSeek Assistant

    All 34 existing tests pass. Let me review the final state of both changed files to make sure everything looks correct:

  40. DeepSeek Assistant

    Let me also verify whether the resizable case might need similar treatment. Let me check how prosemirror-tables columnResizing uses the View:

  41. DeepSeek Assistant

    Let me search for the specific columnResizing plugin implementation:

  42. DeepSeek Assistant

    Let me see how columnResizing creates the NodeView:

  43. DeepSeek Assistant

    Let me check if prosemirror-tables has its own TableView:

  44. DeepSeek Assistant

    Good. The prosemirror-tables has its own built-in TableView for the resizable case. The tiptap extension defaults its View option to @tiptap/extension-table's TableView. My fix addresses the non-resizable case (where addNodeView creates the NodeView), which is the reported issue.

    Let me do a final review of the changes:

  45. DeepSeek Assistant

    The changes look clean. Let me run the tests one final time:

  46. DeepSeek Assistant

    All 34 tests pass. The fix is complete. Let me now go through the checklist:

    Checklist

    1. [x] If an error was reported in the issue description, I have successfully reproduced it.

      • I created a reproduction test that confirmed the <table> element was missing the class="my-custom-table" attribute when Table.configure({ HTMLAttributes: { class: 'my-custom-table' } }) was used with resizable: false (the default).
    2. [x] If an error was reported in the issue description, I have confirmed that my fix resolves the error.

      • After the fix, the same reproduction test passes — the class="my-custom-table" is now correctly applied to the <table> element.
    3. [x] I have thought about edge cases and made sure my fix handles them as well.

      • style attribute in HTMLAttributes: Merged with node-level style, with node-level taking precedence (matching mergeAttributes behavior).
      • class attribute: Added via classList.add() to avoid overwriting any existing classes.
      • Other attributes (e.g., id, data-*): Applied via setAttribute.
      • View: null: addNodeView() returns null, falls back to renderHTML which already handles HTMLAttributes correctly.
      • resizable: true: addNodeView() returns null (the columnResizing plugin handles the NodeView); this is a separate issue in prosemirror-tables.
      • Custom View implementations: The 4th argument (HTMLAttributes) is safely ignored by JavaScript if the custom constructor only expects 3 parameters.
      • Backward compatibility: All 34 existing tests pass unchanged.
    4. [x] I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass.

      • All 34 tests across 5 test files in packages/extension-table/__tests__/ pass.

    Summary of Changes

    Two files were modified:

    1. packages/extension-table/src/table/TableView.ts: Added an optional 4th parameter HTMLAttributes to the TableView constructor. When provided, the HTML attributes (class, style, id, data-*, etc.) are applied to the inner <table> element. The style attribute is merged with node-level styles (node takes precedence), class is added via classList.add, and all other attributes are set via setAttribute.

    2. packages/extension-table/src/table/table.ts: Modified addNodeView() to pass this.options.HTMLAttributes as the 4th argument to the View constructor when creating the NodeView.

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