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

Set 'vertical-align:top' positioning on table headers and cells #1064

Closed
wants to merge 1 commit into from

Conversation

stevenaproctor
Copy link

Added vertical-align: top for table headers and table cells.

At the moment, content is vertically aligned to the centre of the cell, which means the content starts at different places depending on the row height.

This is harder to scan and read for all users and means a screen magnifier user may not be able to see the contents of the cell without scrolling down and then up to read the next cell. Also, I believe it is a typographic convention in printed documents to align content to the top of the cell.

I think top should be the default for all tables but this could be a table class. If that what would be preferred, I could update the PR and when it is merged update the GOV.UK Design System documentation too.

@kr8n3r
Copy link

kr8n3r commented Nov 16, 2018

as we don't build a preview app from external PR, the visual change is

before:
screen shot 2018-11-20 at 15 19 42

after:
screen shot 2018-11-20 at 14 57 44

this would be a change from Elements

@stevenaproctor
Copy link
Author

@igloosi In the second screenshot, January should be aligned to the top as well.

@stevenaproctor
Copy link
Author

Here is my before and after from a table in the design system.

image

image

Copy link

@dashouse dashouse left a comment

Choose a reason for hiding this comment

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

Good call, approved from a design perspective.
Not sure if this will be a considered a breaking change or not though?

@kr8n3r
Copy link

kr8n3r commented Nov 21, 2018

I believe we consider this a breaking change so going to attach a v3.0.0 release milestone to it for now.

@kr8n3r kr8n3r added this to the v3.0.0 milestone Nov 21, 2018
@kr8n3r kr8n3r changed the title Updated table scss Set vertical-align:top on tab;e Nov 21, 2018
@kr8n3r kr8n3r changed the title Set vertical-align:top on tab;e Set vertical-align:toppositioning on table headers and cells Nov 21, 2018
@kr8n3r kr8n3r changed the title Set vertical-align:toppositioning on table headers and cells Set 'vertical-align:top' positioning on table headers and cells Nov 21, 2018
@@ -22,6 +22,7 @@
padding: govuk-spacing(2) govuk-spacing(4) govuk-spacing(2) 0;
border-bottom: 1px solid $govuk-border-colour;
text-align: left;
vertical-align: top;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should only vertically align top for cells?

And consider vertically aligning bottom for headers (or doing nothing)?

Copy link
Contributor

Choose a reason for hiding this comment

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

We've just hit this (when converting our existing table templates to the Design System code).

The default of middle is definitely weird - there’s very few circumstances where that looks right.

Our current behaviour is to vertically-align headers to the top, partly because that makes most sense with our 'sortable' indicator, and partly because they sometimes have a parent header above them, which it’s good to be close to.

Eg see:

Screenshot 2019-03-22 at 13 27 26

Both top and bottom are valid options though, so whichever one is picked for the default, it would be good to have an override, eg govuk-table__header--vertical-align-top. Same for cells probably?

@NickColley
Copy link
Contributor

Got this merged in #1345 :)

@NickColley NickColley closed this May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

5 participants