Problem/Motivation

Test the USWDS stack mode. You might notice although the data is stacked correctly there are no headings on it.
That's because uswds does table rows twice with an attribute as seen in the example below.
https://github.com/uswds/uswds/blob/develop/packages/usa-table/src/usa-t...

Proposed resolution

Add the attribute and add the header properties to the table body as seen in their example.
By missing the heading attributes on mobile it violates the a11y benefits as one can't tell what one is looking at.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bernardm28 created an issue. See original summary.

smustgrave’s picture

Version: 3.0.x-dev » 3.1.x-dev
Status: Active » Postponed (maintainer needs more info)

Did you apply the filters on the text formatter?

bernardm28’s picture

StatusFileSize
new85.8 KB

I did, but USWDS does not include the data label. So the table will be stacked but the table headings will be hidden.

https://designsystem.digital.gov/components/table/#component-variants-table
image explanining issue

They say, that part of the implementation they left up to the developers due to the complexity of how many variations there can be I imagine.

bernardm28’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new363.85 KB
new334.96 KB

Here is what the before and after look like.

Before
before code

After
after the change

The code above does make a few assumptions but for basic scenarios it gets you there and might be easier to modify for more advanced used cases.

bernardm28’s picture

Pretty cool how USWDS is stacking the tables with just CSS. But kind of unfortunate that means somethings they could not solve, like the table headings.

bernardm28’s picture

Title: uswds table is missing heading attributes on stacked mode » USWDS table stacked is missing data-labels attribute. No table headers on a mobile views
bernardm28’s picture

Title: USWDS table stacked is missing data-labels attribute. No table headers on a mobile views » USWDS table stacked is missing data-labels attribute. No table headers on mobile view.
smustgrave’s picture

Status: Needs review » Needs work

The filter should be fixed vs aftermarket in this case

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)

1 are you setting the table header in the ckeditor?
Is the uswds stackable filter turned on.

Not able to reproduce.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Fixed

Actually did find a bug where scope="row" was not being set.

#3481732: Stacked table without header causes warnings I'm going to log an error that a table is missing a header and add a warning on the text formatter if you don't set the filter.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.