External links opening in new tabs should be optional (a11y)
under review
Ivan Boothe
Currently it seems that all external links in content are opened by default in new tabs. It would be nice if that were configurable, because there's a general consensus that it's bad for accessibility.
The link behavior seems to be a core part of
<Link/>
:("External links also work, and automatically have these props:
target="_blank" rel="noopener noreferrer".
" as of 2.0.0-beta.17)It looks like controlling the target of external links in the sidebar is planned -- https://docusaurus.io/feature-requests/p/support-target-for-sidebar-links -- maybe for navbars too? (At the moment
target
isn't listed as an available option on either.)But even if that ability lands, what I'm talking about is the default behavior of links within content pages. Overriding the default behavior would currently require using HTML
<a>
elements instead of standard Markdown links -- on every link.Evidence on why opening new tabs automatically is bad for a11y is pretty voluminous, but here's a quick rundown of links:
https://www.w3.org/TR/WCAG20-TECHS/G200.html and the related failure criterion https://www.w3.org/TR/2016/NOTE-WCAG20-TECHS-20161007/F22
I'm not suggesting here to change the default behavior (although I'd be in favor of that), just to give Docusaurus users the ability to control this behavior. Especially since the current behavior will result in failure of WCAG 2.0 AA level and the UK gov'ts accessibility guidelines, as noted above.
If for some reason you cannot provide control over this behavior, it would be nice to at the very least inform screen readers that these links will be opening a new tab using screen-reader-only text (CSS off-screen -- detailed here https://codersblock.com/blog/external-links-new-tabs-and-accessibility/#how-to-inform-your-users )
Thanks for considering.
Mike Howes
Is there an update on this feature? Would love to have an option to specify whether links (internal or external) always open in a new tab, always open in the same tab, or only external links open in a new tab.
Joshua Chen
Thanks for the detailed info. Would you mind posting an issue, so we can keep track of this better?
Ivan Boothe
Joshua Chen: Sure! I was going to do that originally but the feature request item directed me here. Would you consider this a bug report or a proposal?
Joshua Chen
Ivan Boothe: a11y issues are usually bug reports, but you can also use proposal if you don't want to fill that template ;) Appreciate it!
Joshua Chen
under review