Skip to content

Move table row/column insertion controls to a floating menu (#8409) - #8416

Open
r4-rahul123 wants to merge 3 commits into
plone:mainfrom
r4-rahul123:feature/table-floating-menu
Open

Move table row/column insertion controls to a floating menu (#8409)#8416
r4-rahul123 wants to merge 3 commits into
plone:mainfrom
r4-rahul123:feature/table-floating-menu

Conversation

@r4-rahul123

Copy link
Copy Markdown

Closes #8409

Summary of changes

  • Updated the Table block edit component (TableBlockEdit.jsx) so that the row and column insertion/deletion controls float contextually above the currently selected row rather than staying fixed at the top of the table.
  • Reuses the existing toolbar buttons and icons as guided in Move table row/column insertion controls to a floating menu #8409 (comment).
  • Added smooth transition when navigating between table rows.
  • Added Towncrier news entry (8409.feature).

@boring-cyborg

boring-cyborg Bot commented Sep 2, 2026

Copy link
Copy Markdown

Caution

The Volto Team has suspended its review of new pull requests from first-time contributors until the release of Plone 7, which is preliminarily scheduled for the second quarter of 2026.
Read details.

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, read
Plone's Code of Conduct,
Contributing to Plone,
First-time contributors, and
Contributing to Volto,
as this will greatly help the review process.

Welcome to the Plone community! 🎉

cell: 0,
});
const tableRef = useRef(null);
const [toolbarTop, setToolbarTop] = useState(-32);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-32 and -34 are fixed numbers. If the CSS changes the button height, it will cause issues. The offset can be calculated using only CSS, based on the toolbar's actual height. Something like this:

.block.table {
  --toolbar-gap: 2px;
 .toolbar {
    top: 0;
    transform: translate(-50%, calc(-100% - var(--toolbar-gap)));
    transition: top 0.15s ease-in-out;
  }
}

This way, toolbarTop is used solely to define the top position (which line the toolbar should align with).

if (rowEl) {
setToolbarTop(rowEl.offsetTop - 34);
}
}, [selected, selectedCell, data.table]);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can rely solely on:

selectedCell.row, selected, and data.table?.hideHeaders

to avoid unnecessary re-renders.

@r4-rahul123
r4-rahul123 force-pushed the feature/table-floating-menu branch from b65c34d to 52069d1 Compare September 4, 2026 16:16
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 volto | 🛠️ Build #34395737 | 📁 Comparing b65c34d against latest (799e67d)

  🔍 Preview build  

1 file changed
± release-notes/index.html

@r4-rahul123

Copy link
Copy Markdown
Author

Hi @wesleybl,

Thank you for the review and helpful suggestions!
I have updated the code to:

  1. Handle toolbar height and offset purely via CSS using transform: translate(-50%, calc(-100% - var(--toolbar-gap))) and transition: top 0.15s ease-in-out.
  2. Use rowEl.offsetTop directly for toolbarTop.
  3. Optimize the useEffect dependencies to [selected, selectedCell?.row, data.table?.hideHeaders].

All lint and unit tests are passing and the branch is up to date with main. Please let me know if any further adjustments are needed!

@r4-rahul123
r4-rahul123 requested a review from wesleybl September 4, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move table row/column insertion controls to a floating menu

2 participants