-
Notifications
You must be signed in to change notification settings - Fork 20
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 column alignment in the "More on GOV.UK" homepage component #3253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I'm seeing an odd behaviour in Safari1 - when tabbing through the list of links, the "Check your State Pension age" link moves to the left column: Then when tabbing to the next link, it reverts back to the second column: This behaviour doesn't happen on the live version of the homepage. Footnotes
|
d5b49ad
to
ffd89d7
Compare
ffd89d7
to
5f3df65
Compare
In tablet view and above, the columns in this component were misaligned with the columns in the Featured component above. This is due to two incompatible layout approaches. Several approaches to align these elements were investigated, using combinations of float based layouts and CSS grid. However these approaches did not yield any compatible alignments, possibly due to differences in how browsers calculate `%` widths vs `fr` widths. The fix was to use CSS `columns` with a `column-gap` matching the gutter in the row/columns layout classes, and limiting the width of the list to two columns out of three (66.66%). This aligns the elements correctly while keeping the required top -> bottom then left -> right behaviour of the links. Note that the `break-inside: avoid-column` and the padding-top and padding-bottom tweaks are used to prevent triggering a possible bug in Safari where focused anchors in a multi-column layout cause links to jump between columns. As this is not a long-term robust solution, we should investigate this further for a possible refactor.
5f3df65
to
ce676f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - and thanks for fixing that quite esoteric Safari bug 👍
In tablet view and above, the columns in this component were misaligned with the columns in the Featured component above. This is due to two incompatible layout approaches.
Several approaches to align these elements were investigated, using combinations of float based layouts and CSS grid. However these approaches did not yield any compatible alignments, possibly due to differences in how browsers calculate
%
widths vsfr
widths.The fix was to use CSS
columns
with acolumn-gap
matching the gutter in the row/columns layout classes, and limiting the width of the list to two columns out of three (66.66%). This aligns the elements correctly while keeping the required top -> bottom then left -> right behaviour of the links.Note that the
break-inside: avoid-column
and the padding-top and padding-bottom tweaks are used to prevent triggering a possible bug in Safari where focused anchors in a multi-column layout cause links to jump between columns. As this is not a long-term robust solution, we should investigate this further for a possible refactor.Heroku preview
Trello card
Visual changes
Before
After