Skip to content

Commit

Permalink
Add tabIndex: -1 to hidden links
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Jun 21, 2020
1 parent c9cb4a3 commit 1fab930
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function autolink(options) {
method = inject

if (!props) {
props = {ariaHidden: 'true'}
props = {ariaHidden: 'true', tabIndex: -1}
}
}

Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ Supplying `prepend`, `append`, or `wrap` will ignore the `group` option.
###### `options.properties`

Extra properties to set on the link (`Object?`).
Defaults to `{ariaHidden: true}` when in `'prepend'` or `'append'` mode.
Defaults to `{ariaHidden: true, tabIndex: -1}` when in `'prepend'` or
`'append'` mode.

###### `options.content`

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/behavior-append/output.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1 id="foo">Bar<a aria-hidden="true" href="#foo"><span class="icon icon-link"></span></a></h1>
<h1 id="foo">Bar<a aria-hidden="true" tabindex="-1" href="#foo"><span class="icon icon-link"></span></a></h1>
2 changes: 1 addition & 1 deletion test/fixtures/behavior-prepend/output.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1 id="foo"><a aria-hidden="true" href="#foo"><span class="icon icon-link"></span></a>Bar</h1>
<h1 id="foo"><a aria-hidden="true" tabindex="-1" href="#foo"><span class="icon icon-link"></span></a>Bar</h1>
2 changes: 1 addition & 1 deletion test/fixtures/content-multiple/output.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1 id="foo"><a aria-hidden="true" href="#foo"><!--Foo -->bar<!-- baz--></a>Bar</h1>
<h1 id="foo"><a aria-hidden="true" tabindex="-1" href="#foo"><!--Foo -->bar<!-- baz--></a>Bar</h1>
2 changes: 1 addition & 1 deletion test/fixtures/content-one/output.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<h1 id="foo"><a aria-hidden="true" href="#foo"><!--Tada!--></a>Bar</h1>
<h1 id="foo"><a aria-hidden="true" tabindex="-1" href="#foo"><!--Tada!--></a>Bar</h1>
2 changes: 1 addition & 1 deletion test/fixtures/default/output.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<p>Alpha</p>
<h1 id="bravo"><a aria-hidden="true" href="#bravo"><span class="icon icon-link"></span></a>Charlie</h1>
<h1 id="bravo"><a aria-hidden="true" tabindex="-1" href="#bravo"><span class="icon icon-link"></span></a>Charlie</h1>
<p>Delta</p>

0 comments on commit 1fab930

Please sign in to comment.