-
Notifications
You must be signed in to change notification settings - Fork 90
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
Fix table semantics #476
Fix table semantics #476
Conversation
Thanks @selfthinker, the tables were copied from the maternity pay calculator, they use headings rather than table captions - so that would be a mistake I introduced in copying them over. Thanks for the fix! As for the numeric tabular data, that looks good too. @edwardhorsford mentioned they shouldn't have padding on the right of the table cell, to ensure the content is right aligned with no spacing - could you please remove that as part of this PR too. |
Make row headers out of the first column cells for better semantics and accessibility. As our current default for `th` is bold and that looked weird with the longer content which was in those cells, this changes the content to an example which has shorter row headers. It also changes to an example which is clearer out of context.
704da1b
to
f13ab3b
Compare
The 'Data in a table' example table wrongly uses `thead` for a caption. This moves that into a `caption` element. And it adds some basic styling for it, resetting the center align.
I've sat with @edwardhorsford yesterday and we played around with various caption stylings and decided to do two things to it:
The only uncertainty was around the border that was underneath the (fake) caption and isn't there now (because it isn't in a table row anymore). When there are already bold cells underneath, it just looks like another row and not like a caption: When the caption is larger, it looks even weirder, and it's not clear the border belongs to it: When we use the same example as for the other table and won't have a border, it also looks lost: Only when making it larger (with Does that make sense? If anyone doesn't like it, do you have other ideas we could try? |
f13ab3b
to
967ae3f
Compare
Thanks @gemmaleigh, I have created a new PR for the padding on the right, as I don't think it really fits in here. See #482. I have another one related to this to follow as well. I have now updated all the things, so the PR is ready to be looked at (and/or merged). The only uncertainty is around a potential border under the caption, as mentioned above. |
Hi @selfthinker thanks, I've merged #482. In summary - this PR aligns the caption to the left and doesn't introduce a border underneath the caption. Looks good to me, i'd like to also add guidance around use of table captions - but that can go in a new PR. |
Thanks @gemmaleigh. I've added some guidance into #488. Let me know what you think. |
The table examples on http://govuk-elements.herokuapp.com/data/ have some semantic and therefore accessibility issues.
What problem does the pull request solve?
th
). When I tried that, it didn't look right because there was too much bold. Adding more styling to remove that depending on types of tables would open a whole new can of worms, so I opted to change the content of the table instead. That should also make the table clearer out of context. (The data for that table was taken from https://www.gov.uk/vehicle-tax-rate-tables/other-vehicle-tax-rates)thead
wrongly. I moved that into acaption
instead. And as we didn't have any styling for captions yet, I've added that as well. Hopefully this will also make it easier for services to use captions. (I noticed the vast majority of tables on gov.uk don't have any.)I wasn't sure if to style
caption
directly or give it a class.table-caption
as tables are one of the few elements within Elements which are styled globally. I'm happy to change to a class instead.How has this been tested?
I have mostly tested the caption styling in various browsers via BrowserStack. All was fine except some older browsers showed double the spacing: Android 4 (but 4.4 was fine) and iOS 4 and 5. As we're not officially supporting those anymore and the styling on them is not really bad, I'd suggest to just ignore those issue.
Screenshots
Numeric tabular data - before
Numeric tabular data - after
Data in a table - before
Data in a table - after
What type of change is it?