Repository navigation
feat(pages): add a tabs widget whose tabs hold their own widgets - #3217
rubenvdlinde wants to merge 19 commits into
Conversation
7e2a1c0 to
2e55f28
Compare
2e55f28 to
1181602
Compare
1181602 to
6472d8c
Compare
6472d8c to
5dda44c
Compare
5dda44c to
dfb367d
Compare
AndyScherzinger
left a comment
There was a problem hiding this comment.
Review focused on performance, accessibility, security, clean code and architecture. The UI checks ran on a dev instance (MariaDB) with the frontend built from this PR, on pages with tabs widgets set up through the API. They covered axe-core 4.14 on a page with a tabs widget (only the four rules of the table grid that main already has, tracked separately), the tabs with the keyboard (arrows, Home, End, Enter work), the heading levels, saving, configuring, adding to a tab, narrow tabs widgets at 1920 px, and tab switches with a table in a tab.
Fixed by this PR, confirmed on the instance: saving an unchanged page keeps the widgets in their tabs (raised on #3213), and "Configure widget" on a tabs widget opens a working dialog (raised on #3214). Removing the last tab moves its widgets into the new last tab, and "Add widget to this tab" doesn't offer the tabs type and returns focus to its button.
Security: nothing found. Tab titles and widget texts are rendered as text, and the server validates the tabs setting again.
Also seen here, from earlier PRs:
- The "Tabs, one per line" field shows the placeholder "Leave an empty line between paragraphs" from
SchemaForm(the risk raised on #3214). - After the "Configure widget" dialog closes, focus is on
<body>: the menu item that opened it no longer exists (reproduced; the dialog is from #3214, the configure flow from #3215). WidgetService::appendDataWidget(#3211) counts the widgets inside tabs when it places a table added later on the start page, which leaves a gap below a tabs widget; counting only widgets with no parent fixes it (code check only).
dfb367d to
5c07fba
Compare
5c07fba to
08501f7
Compare
08501f7 to
6a64d79
Compare
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
189a625 to
b7a29d7
Compare
b7a29d7 to
1f75170
Compare
1f75170 to
91ab65a
Compare
A tabs widget puts several grids in the room of one: each tab holds its own widgets, tables and views included. The tab strip follows the tabs pattern for the keyboard, and in edit mode each tab can get widgets of its own, saved with parentIndex and parentTab. A table or view widget shows the description of its table or view behind a button. Co-authored-by: taiebot <13300652+taiebot@users.noreply.github.com> Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
A data widget shows the title of its table in its own heading, the table inside no longer repeats it. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…abs spec Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…mponent The page and every tab of a tabs widget rendered their canvas and widgets with their own copy of the same template, and each tabs widget built its own widget map. GridLevel renders one level from what the page provides, with the widget map built once there, so a new widget action is wired in one place. A data widget without a table now hides outside edit mode in a tab as well. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
GridStack takes a grid created inside an item of another grid for its sub grid and sends its changes to the outer grid, which looped between the two in edit mode after a tab switch. The canvas of a tab now detaches from the page grid right after it starts. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…panel The button switched between "Show description" and "Hide description" while aria-expanded changed too, and every widget's button had the same name. It is called "Description of <title>" now and leaves the state to aria-expanded. The panel stays in the page once opened, so aria-controls only points to it while it exists. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The canvas of a tab chose its columns from its own width, so a tabs widget narrower than about two thirds of the page showed its widgets reflowed, without the steps to arrange them and with a hint that no window fixes. A nested canvas now arranges whenever the page canvas does and only reflows with it; only the page shows the hint. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…dget The tabs widget provided the heading level it had when it was created, so widgets in a tab kept it after the tabs widget got or lost a title. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Each tab switch destroyed the open tab and built the other, so a data widget in a tab loaded its rows again behind a spinner and lost its sorting, filter, search and scroll position. A tab is now mounted when it is first opened and kept with v-show, each with its own tabpanel, so its canvas is also no longer created again on every switch. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…usable Every tab list was called "Tabs", so two tabs widgets could not be told apart; it takes the title of the widget when it has one. The tab panel scrolls, so it gets tabindex 0 as in the APG tabs example, which lets it scroll with the keyboard in Safari. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The prompt to name the tabs could not show, since a tabs widget has at least one tab, while an empty tab showed viewers an empty panel. An empty tab now tells viewers it is empty and asks editors to add widgets to it. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…widget Both tab lists move the focus through one rovingTabTarget() helper, which leaves keys with Alt, Ctrl or Meta to the browser and starts from the tab the key was pressed on. The tabs widget keeps one tab in the tab order when its tabs change and returns to the open tab when the focus leaves it; in both lists a click puts the clicked tab back in the tab order. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
TableWrapper is only used by data widgets, which always collapse the description, so its other branch goes. AddWidget no longer keeps the tabs type for a configured tabs widget in a tab, which the server refuses, nor does configureWidget set the tab it needed. The tabs widget reads its settings from its widget, and the ids come from the widget key and useId() instead of counters at module level. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…label Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The server keeps the tabs of a tabs widget as a list of {key, title} and a
widget in a tab names the key of its tab, so the tabs widget, the grid levels
and the save now use that key instead of a position. Renaming, reordering or
inserting a tab keeps every widget in its tab, and the open tab stays open.
A tab that is removed in the widget settings moves its widgets onto the page,
below the widgets already there, each tab's widgets keeping their places
relative to each other. Nothing is deleted without being seen, the move can be
undone by cancelling the page edit, and no second dialog opens inside the
widget dialog.
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
A setting of type `tabs` gets its own editor in the widget settings instead of a textarea with one tab per line: add a tab, rename it, move it up or down and remove it. The editor stops at the `maxItems` of the schema, says how many tabs there are, and marks a title of blanks only by the rule of the server, so no-break, ideographic and zero width spaces count as blank too. Every button is named after its tab, a move or removal is announced in a live region, and the focus stays on a working button or moves to the next tab. A new tab gets a key of twelve hex digits right away, as the server makes them, so widgets can be put in it before the page is saved. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Tabs stay mounted once opened, so the add button is looked up in the panel of the open tab; the text widget is called "Text". Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…le name The same rule as the grid pages spec: a filter on the text of the list item also passes when the option is announced under another name. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
91ab65a to
c4cff6d
Compare
Part of #3099, on top of #3216 (start page). The UI of the tabs widget from #3212: several grids in the room of one, each tab holding its own widgets, tables and views included. The tab strip and the description button come from #3091 by @taiebot, who is co-author of the commit; here they live in a widget instead of on the start page.
Like #3212, this can be dropped without affecting the others if the model of #3212 isn't wanted.
Size: 680 lines: 466 code and 214 tests.
What changes
parentIndexandparentTabfor the widgets in a tab. Removing a tabs widget removes the widgets in its tabs. The widget dialog doesn't offer Tabs inside a tab.aria-expanded,aria-controls) instead of above the rows, so tables in a widget keep their room.How it was tested
On Nextcloud 34 with PostgreSQL:
context-tabs-widget.spec.ts: tabs with a text and a table, the keyboard, the description button; adding a widget to a tab in edit mode and finding it after a reload.context-grid-pages.spec.tsagain.TabsWidget.cy.js(one grid per tab, keyboard, saving withparentIndex) andCollapsibleDescription.cy.jsnpm run lint,npm run stylelintandnpm run buildKnown gap: dragging a widget inside a tab with the mouse doesn't move it yet; the drag is taken by the grid of the page (GridStack nested in GridStack). Moving and resizing from the widget's menu works inside tabs, and dragging on the page itself works. This needs fixing before this pull request leaves draft.
🖼️ Screenshots
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)