-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Accessibility: Assign proper element roles using semantic HTML or role
attributes
#2295
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
Comments
role
attributesrole
attributes
These will be really great improvements! The breaking changes would be more ideal in terms of code quality. Maybe we can release this in such a way so that people not using versioned URLs will not get the update, by f.e. releasing the next major version on a new path? For example:
The downside of this is that we will be publishing old and new versions. F.e. 5.0 will have 4 and 5. 6.0 will have 4, 5, and 6. Etc. What if we just keep the last two or three versions, and delete a version after it has been logging a message to console for a year (or some time value)? F.e. a user who currently does not use versioned URLs will start to see something like this in console:
|
Thanks! They're implemented and ready for review in #2304. 😄
I opted to implement the above enhancements as non-breaking changes for the following reasons:
I realize discussions about what comes after v5 may introduce eye rolls given how long it's taken us to get anywhere near a v5 release, but I believe we can keep the next two releases narrow in scope and release them in a reasonable time frame.
Yep. Agreed. The following approach makes sense to me: v5Summary
Release details
v6Summary
Release details
I don't think we need to worry about publishing older versions after v5 is released. The CDN handles making older versions available via URL version locks (see above). The issue we're forced to deal with for v5 is the fact that early v4 documentation recommended using |
Sounds good. I think we can go with the non-ecosystem-breaking approach first, and keep good notes on how to convert that to the better format in the ecosystem-breaking change later. I know that CDNs support versions numbers in the URLs, but for websites that have no version numbers, they'll break if we eventually remove the v4 paths. Perhaps v4 is the only file path we support for a while, and the new path will simply break people if they do not use a version number but we make that very clear in the docs. I need to refresh on the output format and come back with a concrete plan of action for it (or do you already have one?) |
Right. The proposal above will break v4 sites without an It's worth mentioning that publishing any breaking change will likely break old v4 sites since there was a time when our documentation recommended loading the latest docsify version without a version lock or a path: <script src="//unpkg.com/docsify"></script> This was a long time ago though and I don't know of any workarounds worth considering.
Haven't thought about it much, but I assume we would want to offer both an IIFE (as we do today) and an ES module. Let's continue to conversation in Discord or a public discussion since this issue is closed. |
Feature request
Docsify does not use semantic HTML or assign
role
attributes properly. This introduces accessibility issues by preventing screen readers from identifying and navigating directly to important areas like the main content and site navigation.Fortunately, these issues can be address easily and in a non-breaking way by assigning appropriate WAI-ARIA roles to existing elements. If breaking changes are permitted, it would be preferable to revisit Docsify's DOM structure and use of HTML tags which would reduce the need to assign
role
attributes.Problem or desire
<main>
element is improperly used as a wrapper for the sidebar, the sidebar toggle button, and the main content. As a result, screen readers are are unable to navigate directly to the main page content.<nav>
element or assigned arole
ofnavigation
. As a result, screen readers are unable to navigate directly to the site's primary navigation.<nav>
element and no other element has been assigned arole
ofnavigation
. As a result, screen readers 1) improperly identify the top navigation as the site's primary navigation and 2) are unable to identify/navigate directly to any site navigation when the top nav is not rendered.<h1>
element. As a result, screen readers incorrectly identify this is a level one heading instead of a site banner which typically contains the site name/logo. Rendering as an H1 also presents multiple level one headings in the document structure which, while technically valid, is confusing for users.<div class="progress">
element. As a result, screen readers are unable to detect or announce progress updates.role
attribute. As a result, screen readers are unable to identify the type of content it contains.role="search"
, does not render search progress on the screen, and uses a<div>
element withoutrole="button"
as a clear button button. As a result, screen readers are unable to identify and navigate directly to the landmark search functionality, provide meaningful search progress feedback to screen readers, or indicate to screen readers that a clear button exists.Proposal
For the main content:
role="main"
to Docsify's<article id="main">
element androle="none"
to the<main>
element.<main>
element and remove unnecessary "main" ID and wrapper elements like<section class="content">
.For the sidebar / primary navigation:
role="none"
to the<aside class="sidebar">
element.role="navigation"
andaria-label="primary"
to the<div class="sidebar-nav">
element.<div class="sidebar-nav">
element with a<nav aria-label="primary">
element.For the top navigation:
aria-label="secondary"
to the<nav class="app-nav">
element.For the site name/logo:
<header>
instead of<h1>
, then wrap the site name/logo and the search feature within a<banner>
element.For the progress bar:
role="progressbar"
and related aria attributes to the<div class="progress">
element.<div class="progress">
with a<progress>
element.For the cover page:
role="complementary"
andaria-label="cover"
to the<section class="cover">
element.<section class="cover">
with<aside class="cover">
For the search plugin:
<div class="results-status" aria-live="polite">
element to provide search progress feedback.aria-label="search result N"
to each<div class="matching-post">
element.role="search"
to the<div class="search">
element.Implementation
See above.
The text was updated successfully, but these errors were encountered: