-
Notifications
You must be signed in to change notification settings - Fork 687
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
refactors Source Interface for semantic HTML5/ARIA markup #6041
Conversation
484cbd7
to
3ad7b2e
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6041 +/- ##
========================================
Coverage 85.11% 85.11%
========================================
Files 55 55
Lines 3863 3863
Branches 479 479
========================================
Hits 3288 3288
Misses 463 463
Partials 112 112
Continue to review full report at Codecov.
|
b0ef502
to
80547cd
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.
This is amazing work @cfm !!! Love to see efforts towards making the HTML more semantic and accessible. I have left some small comments/questions that caught my eyes. Few are probably bigger changes which might need their own separate issues.
Corrects 876bfa2's removal of these decorative IMGs without replacing their semantic content. thread: #6041 (comment) squash/fixup: 876bfa2
e8c4073
to
c6cd5af
Compare
Adds explicit ARIA-LABEL attributes to elements whose strings are in all caps to support idiomatic translation (cf. #5821, #6003). thread: #6041 (comment)
Adds explicit title-case ARIA-LABEL attributes to elements whose strings are in all caps to support idiomatic translation (cf. #5821, #6003). thread: #6041 (comment)
79b5924
to
17eb17a
Compare
Refactors MAIN.index-row rather than wrapping the whole DIV.grid in MAIN. thread: #6041 (comment) squash/fixup: 80547cd
Adds explicit title-case ARIA-LABEL attributes to elements whose strings are in all caps to support idiomatic translation (cf. #5821, #6003). thread: #6041 (comment)
Refactors MAIN.index-row rather than wrapping the whole DIV.grid in MAIN. thread: #6041 (comment) squash/fixup: 80547cd
3ac7810
to
92a22c6
Compare
Adds explicit title-case ARIA-LABEL attributes to elements whose strings are in all caps to support idiomatic translation (cf. #5821, #6003). thread: #6041 (comment)
Refactors MAIN.index-row rather than wrapping the whole DIV.grid in MAIN. thread: #6041 (comment) squash/fixup: 80547cd
92a22c6
to
07cd655
Compare
LABEL[for="codename"] was marked HIDDEN to prevent redundant narration in screen readers. Refactoring the LABEL to an H2 that ARIA-labels the containing section streamlines the narration and makes for a more-logical outline. thread: #6041 (comment) squash/fixup: ae56f49
::{before,after} pseudo-elements must be used to style the expand/collapse links ("Show"/"Hide", respectively) because under DIR="ltr" the ::marker pseudo-element will be displayed to the left of the SUMMARY. thread: #6041 (comment) squash/fixup: 1f69640
::{before,after} pseudo-elements must be used to style the expand/collapse links ("Show"/"Hide", respectively) because under DIR="ltr" the ::marker pseudo-element will be displayed to the left of the SUMMARY. thread: #6041 (comment) squash/fixup: 1f69640
66ab8ba
to
c8baf3d
Compare
The changes of |
reconciles JavaScript-free locale selector with ARIA best practices Accessible checkbox-based menus (e.g., hamburger menus[1]) tend to rely on JavaScript to update the menu's ARIA attributes in response to changes in state. Here we reconcile the script-free and accessibility requirements so that: 1. the current locale and "Choose locale" menu are announced logically; and 2. the menu itself is annotated to be announced by screen-reader and navigable by keyboard. As a bonus, each locale is now announced *in* that locale, via the A LANG and HREFLANG attributes. [1]: http://www.ashleysheridan.co.uk/blog/Making+an+Accessible+Hamburger+Menu first pass through "/generate" restore div#content and div#container first pass through "/lookup" pass 1.5 through /lookup with replies sets focus to #flashed when POST /submit redirects to /lookup As recommended by <https://webaim.org/techniques/formvalidation/#error>. first pass through "/logout" first pass through "/login" first pass through / first pass through ancillary templates
second pass through /: validate/audit second pass through /lookup: validate/audit second pass through /login: validate/audit second pass through ancillary templates: validate/audit
third pass through /: fix "footer.html" styling Introduces a change in vertical spacing which could be corrected. Journalist Interface breakage: Adds a gratuitous BORDER-TOP to the FOOTER. third pass through /: fix H1 logo styling I've been persuaded[1] that: 1. the logo image is content, rather than decoration, after all, and so can remain an explicit IMG, with an ALT attribute that describes the image rather than offers a tooltip-style TITLE; and 2. on the home page the logo *is* the top-level heading, reflected in both the H1 and the page TITLE. [1]: https://csswizardry.com/2010/10/your-logo-is-an-image-not-a-h1/ third pass through /: fix #js-warning styling third pass through /: fix "locales.html" styling third pass through /generate: "{base,generate}.html" styling third pass through /generate: "Refresh Codename" button styling third pass through /lookup: fix "lookup.html" styling third pass through /lookup: fix "flashed.html" styling third pass through /: fix "{first,next}_submission_flashed_message.html" styling third pass through /logout third pass through /login: fix "login.html" styling third pass: fix "banner_warning_flashed.html" styling third pass through /why-public-key: fix "why-public-key.html" styling
Replaces STRONG elements with B, according to the latter's new HTML5 semantics[1]. Removes STRONG elements in headings, where they are superfluous both semantically and visually. [1]: https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-b-element
addresses review feedback Corrects 876bfa2's removal of these decorative IMGs without replacing their semantic content. thread: #6041 (comment) squash/fixup: 876bfa2 addresses review feedback Adds explicit title-case ARIA-LABEL attributes to elements whose strings are in all caps to support idiomatic translation (cf. #5821, #6003). thread: #6041 (comment) addresses review feedback Refactors MAIN.index-row rather than wrapping the whole DIV.grid in MAIN. thread: #6041 (comment) squash/fixup: 80547cd removes stray ARIA-LABELS (per review feedback) thread: #6041 (comment) addresses review feedback LABEL[for="codename"] was marked HIDDEN to prevent redundant narration in screen readers. Refactoring the LABEL to an H2 that ARIA-labels the containing section streamlines the narration and makes for a more-logical outline. thread: #6041 (comment) squash/fixup: ae56f49 refactors SECTION#codename-hint as DETAILS (per review feedback) ::{before,after} pseudo-elements must be used to style the expand/collapse links ("Show"/"Hide", respectively) because under DIR="ltr" the ::marker pseudo-element will be displayed to the left of the SUMMARY. thread: #6041 (comment) squash/fixup: 1f69640 adds "button" role to non-navigating links (per review feedback) thread: #6041 (comment) undoes autoformatting squash/fixup: 1f69640 fixes tests for refactored DETAILS#codename-hint squash/fixup: c8baf3d fixes unclosed ARIA-LABEL attribute (per review feedback) thread: #6041 (comment) squash/fixup: d6116a2 refactors TIME as H3 of reply ARTICLE (per review feedback) Each reply now consists of an ARTICLE automatically labeled by its H3 TIME. These implicit ARIA semantics are more fluent than those marked explicitly in 1f69640. thread: #6041 (comment) squash/fixup: 1f69640 refactors OUTPUTs as MARKs or Ps (per review feedback) Some "browser / screen reader pairings may not announce or make available the accessible name of the output, even though its a labelable element"[1], apparently including Orca (i.e., on Tails). These elements give the next-best semantics without implying a live region. [1]: https://www.scottohara.me/blog/2019/07/10/the-output-element.html thread: #6041 (review) squash/fixup: 1f69640 squash/fixup: f37fc17 squash/fixup: ae56f49
A refactoring like #5986 seems like a good opportunity for this kind of reformatting.
245689f
to
8f2b503
Compare
addresses review feedback Corrects 876bfa2's removal of these decorative IMGs without replacing their semantic content. thread: #6041 (comment) squash/fixup: 876bfa2 addresses review feedback Adds explicit title-case ARIA-LABEL attributes to elements whose strings are in all caps to support idiomatic translation (cf. #5821, #6003). thread: #6041 (comment) addresses review feedback Refactors MAIN.index-row rather than wrapping the whole DIV.grid in MAIN. thread: #6041 (comment) squash/fixup: 80547cd removes stray ARIA-LABELS (per review feedback) thread: #6041 (comment) addresses review feedback LABEL[for="codename"] was marked HIDDEN to prevent redundant narration in screen readers. Refactoring the LABEL to an H2 that ARIA-labels the containing section streamlines the narration and makes for a more-logical outline. thread: #6041 (comment) squash/fixup: ae56f49 refactors SECTION#codename-hint as DETAILS (per review feedback) ::{before,after} pseudo-elements must be used to style the expand/collapse links ("Show"/"Hide", respectively) because under DIR="ltr" the ::marker pseudo-element will be displayed to the left of the SUMMARY. thread: #6041 (comment) squash/fixup: 1f69640 adds "button" role to non-navigating links (per review feedback) thread: #6041 (comment) undoes autoformatting squash/fixup: 1f69640 fixes tests for refactored DETAILS#codename-hint squash/fixup: c8baf3d fixes unclosed ARIA-LABEL attribute (per review feedback) thread: #6041 (comment) squash/fixup: d6116a2 refactors TIME as H3 of reply ARTICLE (per review feedback) Each reply now consists of an ARTICLE automatically labeled by its H3 TIME. These implicit ARIA semantics are more fluent than those marked explicitly in 1f69640. thread: #6041 (comment) squash/fixup: 1f69640 refactors OUTPUTs as MARKs or Ps (per review feedback) Some "browser / screen reader pairings may not announce or make available the accessible name of the output, even though its a labelable element"[1], apparently including Orca (i.e., on Tails). These elements give the next-best semantics without implying a live region. [1]: https://www.scottohara.me/blog/2019/07/10/the-output-element.html thread: #6041 (review) squash/fixup: 1f69640 squash/fixup: f37fc17 squash/fixup: ae56f49
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, thanks to @cfm for the work and for your patience!
In #6041 we added the "aria-label" attribute in the "render_kw" dictionary passed to each wtforms.fields.Field. Here we add them these attributes directly to the raw INPUT elements.
In #6041 we added the "aria-label" attribute in the "render_kw" dictionary passed to each wtforms.fields.Field. Here we add them these attributes directly to the raw INPUT elements.
Status
Ready for review
img
s and related elements for ARIA labeling #6021Stylistic changes suggested for rebasing after review and before merge:
develop
make lint
) for indentation of HTML in allsecuredrop/source_templates/*.html
Description of Changes
Closes #5986 by:
securedrop/source_templates/*.html
for semantic markup;Known issues
For future work:
RequestLocaleInfo.language_tag
property available in locale selectors #6056 (out of scope)datetime
attributes #6057 (out of scope)h1
s (address in re: WCAG 2.4.2)Testing
Click through the Source Interface and inspect in terms of:
develop
. Changes are intended to be "pixel-perfect" except where there were preexisting idiosyncrasies that more-semantic markup tended to make naturally more consistent. Of course, suggestions for fine-tuning are welcome!Deployment
No special considerations.
Checklist
If you made changes to the server application code:
make lint
) and tests (make test
) pass in the development containerIf you made non-trivial code changes:
I have written a test plan and validated it for this PRLet me know if this is necessary.