docsifyjs / docsify

🃏 A magical documentation site generator.
https://docsify.js.org
MIT License
27.47k stars 5.67k forks source link

Accessibility: Assign proper element roles using semantic HTML or `role` attributes #2295

Closed jhildenbiddle closed 10 months ago

jhildenbiddle commented 11 months ago

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

Proposal

For the main content:

For the sidebar / primary navigation:

For the top navigation:

For the site name/logo:

For the progress bar:

For the cover page:

For the search plugin:

Implementation

See above.

trusktr commented 10 months ago

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:

Important! If you see this message, you are on Docsify v4 and you are not using a version number in the Docsify script URL. This script will stop being available at this location on or after Nov 22, 2024. To prevent your site from breaking, add a version to your URL like so: ....... Or better yet, update to the latest Docsify path....

jhildenbiddle commented 10 months ago

These will be really great improvements!

Thanks! They're implemented and ready for review in #2304. 😄

The breaking changes would be more ideal in terms of code quality.

I opted to implement the above enhancements as non-breaking changes for the following reasons:

  1. The "breaking" options above will impact third party plugins and themes, which we want to avoid if the intention is for v5 to contain only "legacy-breaking" changes.
  2. Updating the UI (modernize, redesign, componentize) seems like a logical enhancement to target next. UI changes will obviously introduce significant breaking changes. I think the community will be better served by delivering the "breaking" accessibility enhancement along with the "breaking" UI updates in a single release (v6) instead of releasing breaking changes in two successive releases (v5 - accessibility, v6 - UI). We don't want plugin and theme authors to have to update their add-ons twice in a relatively short period of time.

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.

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?

Yep. Agreed. The following approach makes sense to me:

v5

Summary

Release details

v6

Summary

Release details


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.

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 @latest in the CDN URLs. Once people move to v5 using our recommended @5 URLs, we can continue publishing new major versions and existing users will be unaffected.

trusktr commented 10 months ago

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?)

jhildenbiddle commented 10 months ago

...for websites that have no version numbers, they'll break if we eventually remove the v4 paths.

Right. The proposal above will break v4 sites without an @ version lock when v6 is released. That's just a suggestion. We can look at CDN statistics when the time comes to help determine if/when we remove 4v paths and redirects.

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.

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?)

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.