Page MenuHomePhabricator

Table: Add CSS-only version
Closed, ResolvedPublic2 Estimated Story Points

Description

Note that this should be done after T360080.

This task covers the CSS-only version of the Table component.

Supported functionality:

  • All structural elements
  • Horizontal scroll
  • Row selection

Note that we may also want to add a demo showing how you could do sorting without JS, but this will be a fairly complex example, so we should consider whether this is needed. An alternative would be showing an example of how to include space for the sort icon without JS, so that you could replace the Table with the Vue version with the sort icon once JS loads without disrupting the layout.

Demos:

  1. Markup structure example that contains the following structural elements. The alignment classes should also be explained above the demo, and used within the demo.
    1. Header content
    2. Table with just a few columns (the Olympics example from the configurable demo can be reused)
    3. Footer content
  2. Additional table features: visually-hidden caption, row headers, and vertical borders. The "list of MediaWikis" example from the "with custom table elements" demo can be reused.
    1. No header, since there is no visible caption
    2. Table content with cdx-table__table--borders-vertical on the table element and row headers
    3. <tfoot> included (as in the Vue version of this demo)
  3. Table with selection. We will need to include a <form> element somewhere and use a submit button in the header, so that something can be done on the backend with the checked checkboxes when the form is submitted. The example from the Vue version of the row selection demo can be reused.

Acceptance criteria

  • The CSS-only Table is documented on the docs site demo page

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
AnneT updated the task description. (Show Details)
CCiufo-WMF triaged this task as Medium priority.Mar 14 2024, 3:01 PM
lwatson set the point value for this task to 2.Mar 18 2024, 5:48 PM

@Sarai-WMDE @CCiufo-WMF I was thinking about the demo for sorting without JS and am concerned with its potential complexity. I looked at some tables onwiki and noted that the ones with sorting enabled only make sorting available when JS is enabled. I think we have a few options:

  1. Don't demonstrate sorting in the CSS-only version at all
  2. Give people a way to leave space for the sort icon without JS, so that they could swap in the Vue version of the table once JS loads without any layout disruption
  3. Build a fully-working example where you can click a sort icon and it reloads the page with the data sorted properly

Based on the use cases we know of, what do y'all think? We could also open a separate task for this and complete it once we have a need for it.

I think it would be fine not to demonstrate sorting in the CSS-only version for the MVP and have a task to add a working example as a follow up. There is a precedent for more "complex" CSS-only demos, for example with the Tabs component. Clicking on the different tabs triggers a full page reload with the new tab selected, like you're suggesting we do for Table sorting. This seems more useful than option 2 because I think it's more likely someone will have a standalone CSS-only Table or standalone JS one.

That being said, what does option 2 actually entail? When you say "Give people a way to leave space for the sort icon without JS", does this mean just showing them how to do it or does this mean we need to actually change the CSS to support this?

Change #1028603 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] Table: Add basic CSS-only component and clean up markup

https://gerrit.wikimedia.org/r/1028603

Change #1028861 had a related patch set uploaded (by LWatson; author: LWatson):

[design/codex@main] Table: CSS-only demos part 2

https://gerrit.wikimedia.org/r/1028861

Change #1028901 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):

[design/codex@main] Table: Add demo of CSS-only row selection

https://gerrit.wikimedia.org/r/1028901

lwatson changed the task status from Open to In Progress.May 7 2024, 11:19 PM
lwatson subscribed.

Change #1028603 merged by jenkins-bot:

[design/codex@main] Table: Add basic CSS-only component and clean up markup

https://gerrit.wikimedia.org/r/1028603

Change #1028861 merged by jenkins-bot:

[design/codex@main] Table: CSS-only row header, vertical borders, hidden caption

https://gerrit.wikimedia.org/r/1028861

Change #1028901 merged by jenkins-bot:

[design/codex@main] Table: Add demo of CSS-only row selection

https://gerrit.wikimedia.org/r/1028901

Change #1032095 had a related patch set uploaded (by VolkerE; author: VolkerE):

[mediawiki/core@master] Update Codex from 1.5.0 to 1.6.0

https://gerrit.wikimedia.org/r/1032095

Change #1032095 merged by jenkins-bot:

[mediawiki/core@master] Update Codex from 1.5.0 to 1.6.0

https://gerrit.wikimedia.org/r/1032095

Volker_E assigned this task to lwatson.
Volker_E removed a project: Patch-For-Review.