Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables style should not rely on scope attribute #648

Closed
deniak opened this issue Aug 2, 2024 · 1 comment
Closed

Tables style should not rely on scope attribute #648

deniak opened this issue Aug 2, 2024 · 1 comment
Assignees

Comments

@deniak
Copy link
Member

deniak commented Aug 2, 2024

Describe the issue
The table component relies on the scope attribute to style the headers.

th[scope="col"] {
  background-color: #024488;
  color: #fff;
}

Removing/Forgetting that attribute will remove the blue background.

Recommended solution
Updating the selector to thead > th will make that attribute optional and ensure all the tables have the same style.

Additional request
We might also need the same changes for tables footer tfoot.

@NicolaSaunders
Copy link

This rule was originally intended in the spirit of "defensive coding", where the lack of the desired visual appearance was aimed at reminding the author of the markup to add the missing scope="col" attribute.

However, I have learned that the scope attribute is not as crucial as I had previously thought for headers in simple tables:

Plus, it was too restrictive to tie the style just to a column scope, when more complex tables may benefit from having the same styles for header cells with row scope. So I am happy to remove the scope attribute entirely for the th selector.

Since heading cells can exist in either thead or tfoot I don't see a need to reference either of those in the th selector.

Proposed fix is at w3c/w3c-website-templates-bundle#148

@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in W3C website agency maintenance Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

3 participants