Skip to content

USWDS - General (Table): Apply theme header background color and color to all th elements#5779

Closed
ajanickiv wants to merge 3 commits into
uswds:developfrom
ajanickiv:add-table-header-styling-to-row-headers
Closed

USWDS - General (Table): Apply theme header background color and color to all th elements#5779
ajanickiv wants to merge 3 commits into
uswds:developfrom
ajanickiv:add-table-header-styling-to-row-headers

Conversation

@ajanickiv

@ajanickiv ajanickiv commented Feb 20, 2024

Copy link
Copy Markdown

Summary

Applied theme header background color and color to all table header (th) elements.
This is not a breaking change.
This will change the look of table header elements in table rows in some cases - applying the header background color and a heavier font weight.

Reason(s) for changes

Changes were inspired by the W3 table documentation to follow the patterns laid out in the tutorial.

Related issue

Closes #5777

Testing and review

Ran the following commands - all passed

  • lint:sass
  • test:sass

Started storybook and tested examples.
Default
image
Borderless
image
Striped
image
Sortable
image
Scrollable Default
image
Scrollable Striped
image
Scrollable Compact
image
Scrollable Compact Striped
image
Stacked Default
image
Stacked Borderless
image
Stacked with Header
image
Stacked with Header Borderless
image

<colgroup span="2"></colgroup>
<colgroup span="2"></colgroup>
<colgroup span="2"></colgroup>
<colgroup span="2"></colgroup>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

info: Added additional colgroup elements to satisfy the requirements laid out by the W3 for irregular headers. "If a header spans two or more columns, use a element instead of that number of elements, and the number of columns spanned is noted in the span attribute." Since there are 6 headers spanning 2 columns each - there should be 6 elements.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for flagging this! Shortly after this PR was made, we updated our table markup and no longer have a user-facing table with multi-column headers.

I've added a comment to uswds/uswds-site#2263 to keep track of as we add examples to our guidance.

<tbody>
<tr>
<th scope="row">Tango</th>
<td>Tango</td>

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

info: Tango, Foxtrot, Hilo, and Bravo are the alphabetical sorting examples and not related to the data in the other columns, so they should td elements, not th

@mahoneycm

Copy link
Copy Markdown
Contributor

Hey there @ajanickiv !

Thank you for your work here. We've decided to separate the markup changes from the style changes to maintain the scope of this work. I'm going to close this in favor of #5986 which will isolate the style changes needed.

We'll add you as a contributor!

@mahoneycm mahoneycm closed this Oct 22, 2024
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.

USWDS - Bug: Table header cells in table body do not get header styling

2 participants