Utilising semantic tags to provide better structure for screen readers - #1464
Conversation
…ontent in HTML to header, "content", aside, footer to provide better structure for screen readers. Subset of intended changes seeking feedback on approach.
There was a problem hiding this comment.
Heya! Just wanna say that overall I think this is a good change, and I'm happy to see it.
That said, you've made two changes at the same time that make this PR difficult to review — You've made simple markup changes (div to main, followers-list class, updating some profiles, etc), and you've reordered some markup (moving the main body content first, with the sidebar following). I like these both, but when they both happen in the same file, the diff becomes useless, because there's just one huge chunk of changes from the order change, and any other changes are hidden.
Can you tease these apart and make one PR with the order changes and another with the markup changes? I'm happy to approve them both, but for the PR where you're moving the code around, please don't make any other changes, so the review is simply "this block of code moved down the page"
… sidebar to end of file) to allow for easier diffing of this PR. Will re-apply in a subsequent PR.
|
Easy done. Have rolled back the reordering changes to be reapplied in a subsequent PR. |
There was a problem hiding this comment.
Thank you for breaking this apart, it was much easier to review.
This is looking good! A few nitpicks and then I'm happy to merge.
Also, could you add an UNRELEASED section to the top of the changelog file listing all the breaking markup changes that will need to be applied in the MLTSHP app? (Or you can do that in the followup PR, if that makes more sense, but it'll need to be done before we bump the version)
| <a class="btn btn-secondary btn-shadow" href="#">Newer »</a> | ||
| </div> | ||
| </div> | ||
| <nav class="linear-navigation" aria-label="Timeline"> |
There was a problem hiding this comment.
Why is this the only one with an aria-label?
There was a problem hiding this comment.
This was the most obvious one to me where a label would help. Not meant to be an exhaustive list though - just an example and conversation starter for this PR.
| } | ||
|
|
||
| > * { | ||
| min-width: 0; // https://github.com/philipwalton/flexbugs/issues/39 |
There was a problem hiding this comment.
Did you confirm that word-wrap works properly in flex containers in Firefox now?
There was a problem hiding this comment.
No, will probably have to add this back in. However existing selector was causing problems with restructured HTML as it is.
There was a problem hiding this comment.
Have added back in.
|
Have addressed the feedback as best I can for now. Should I proceed like so from here?
Suspect there will be things to tidy up after reordering, hence third PR. |
|
Sounds like a great plan! Ping me when you're ready for another review on this PR. 🎉 |
…stead defer to the container to do that e.g. image-content-list li elements. Hoisted image-content-list exceptions out of image-content and image-title (letting the image itself not worry about that). Flattened out image-content section to avoid unnecessary nesting e.g. div > form, when we can just use form. More use of flex gap on containers instead of individual components setting their own margins.
…tags. Reworked a fair bit of CSS too to use flexbox more, retire some floats and clear fixes, and move responsibility for spacing between individual components to the wrapping elements.
There was a problem hiding this comment.
I ran out of time to review in the browser, but wanted to share some code review feedback first.
Also, one request: Since this PR is making so many breaking markup changes, I'd like to see you document them in the changelog to ensure the changes are documented. I know you'll likely be the one implementing the changes in the main repo, but it's good practice to document changes like this. I'd expect something like:
- Change
<div class="main">to<main> - Change
<div class="sidebar">to<aside> - Replace
old-classwithnew-class - etc
Oh, and you've got a CI failure due to linting. If it's prettier, you can probably auto-fix by running npm run lint
There was a problem hiding this comment.
No objections to these changes, but just so you're aware, the API documentation is automatically generated, so these changes may or may not be something we have control over. I think the pattern library page should accurately reflect the markup on the site, so it might be worth checking in the main repo if that's something we can control or not before updating it here.
There was a problem hiding this comment.
Thanks, I'll double check.
There was a problem hiding this comment.
The patterns API page currently embeds the entire page, including wrapper and page footer. Should that be pared back to what other areas include? It seems to be the exception at the moment.
There was a problem hiding this comment.
That's fine — I think I just copy-pasted the whole thing for ease of maintenance. As long as we can see the markup in the pattern library so we can review CSS styles, that's all that really matters.
There was a problem hiding this comment.
I'll trim it back then to just the content to bring it in line with all the others. To leave it means extra wrapper markup that might go stale.
If the generated html needs to adjust to meet the styles half way will take care of that in the mltshp repo.
| box-shadow: none; | ||
| } | ||
|
|
||
| &--blank { |
There was a problem hiding this comment.
As a general rule of thumb, I'd prefer that we avoid using Sass to construct selectors like this — it doesn't save much typing, and it makes maintenance harder, because you can no longer search for the class. The other changes in this file are fine, but please change these to the full class name.
There was a problem hiding this comment.
Easy done. Will fix these up.
| a { | ||
| @include links.link-primary; | ||
| } | ||
| &--blank { |
There was a problem hiding this comment.
Same concern about constructed selectors. Please use the full class name to allow for search.
| .image-edit-title:focus, | ||
| .image-edit-title-hover { | ||
| background-color: var(--color-status-edit); | ||
| &--editable:hover, |
There was a problem hiding this comment.
As above, please don't use Sass to construct selectors.
| } | ||
|
|
||
| > * { | ||
| min-width: 0; // https://github.com/philipwalton/flexbugs/issues/39 |
|
Sure. I'll flesh out the changes in the changelog on this PR. Correct. CI build was a minor linting issue. Felt it could wait until next commit to avoid complicating any reviewing. |
…es that will be required to mltshp repo. Addressed some scss usage, as well as re-enabling uniqueness check in 11ty. Also identified a few issues highlighted by proceeding (in dev) with making the changes to the mltshp code proper.
|
Since browser review is time-consuming, I'll hold off on any further review for now. Broadly speaking, you're heading in the right direction. Looking good! |
…er the areas specific to that page.
|
That's probably it for this PR then (if we're going to leave re-ordering sections for a subsequent one). Rather than merging this in to main and moving on to the next step, how about we create a new branch and work there until it's all ready to go? Means you could still release minor fixes from main, and keeps this work insulated.
|
Sounds good to me |
|
@smallsaucepan What's the status here? No pressure, just trying to make sure you're not blocked by me failing to do something? |
|
All good @spaceninja. I'll merge this onto the dev branch and go from there. There's also MLTSHP/mltshp#865 in play, which would have some overlap with this (classnames, etc). |


Overview
Utilising semantic tags (main, header, article, nav, etc) instead of divs and reordering content in HTML to header, "content", aside, footer to provide better structure for screen readers. Subset of intended changes seeking feedback on approach. Will make further commits based on feedback.
Screenshots
Only visual change should be to alignment of Older and Newer pagination buttons on mobile. They have been moved closer to edge of screen and should line up with edge of image content.
Testing
Have only done a subset of screens initially. Seeking feedback before converting them all. Main ones done are:
Pages should look and behave as they currently do, albeit with different behind the scenes markup.
Some design decisions worth noting: