From 1fab930d1e15e786f7a56a68b756072d2f4ed3d6 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sun, 21 Jun 2020 14:23:52 +0200 Subject: [PATCH] Add `tabIndex: -1` to hidden links Related-to remarkjs/remark-autolink-headings#49. --- index.js | 2 +- readme.md | 3 ++- test/fixtures/behavior-append/output.html | 2 +- test/fixtures/behavior-prepend/output.html | 2 +- test/fixtures/content-multiple/output.html | 2 +- test/fixtures/content-one/output.html | 2 +- test/fixtures/default/output.html | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 0fa7cdb..f69a3b7 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,7 @@ function autolink(options) { method = inject if (!props) { - props = {ariaHidden: 'true'} + props = {ariaHidden: 'true', tabIndex: -1} } } diff --git a/readme.md b/readme.md index b56f716..ea602aa 100644 --- a/readme.md +++ b/readme.md @@ -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` diff --git a/test/fixtures/behavior-append/output.html b/test/fixtures/behavior-append/output.html index 7df8342..edb5b55 100644 --- a/test/fixtures/behavior-append/output.html +++ b/test/fixtures/behavior-append/output.html @@ -1 +1 @@ -

Bar

+

Bar

diff --git a/test/fixtures/behavior-prepend/output.html b/test/fixtures/behavior-prepend/output.html index 20d278b..44624a7 100644 --- a/test/fixtures/behavior-prepend/output.html +++ b/test/fixtures/behavior-prepend/output.html @@ -1 +1 @@ -

Bar

+

Bar

diff --git a/test/fixtures/content-multiple/output.html b/test/fixtures/content-multiple/output.html index 59c635a..e982533 100644 --- a/test/fixtures/content-multiple/output.html +++ b/test/fixtures/content-multiple/output.html @@ -1 +1 @@ -

Bar

+

Bar

diff --git a/test/fixtures/content-one/output.html b/test/fixtures/content-one/output.html index bdb14cb..76ba91f 100644 --- a/test/fixtures/content-one/output.html +++ b/test/fixtures/content-one/output.html @@ -1 +1 @@ -

Bar

+

Bar

diff --git a/test/fixtures/default/output.html b/test/fixtures/default/output.html index 2d94abe..8a76b5b 100644 --- a/test/fixtures/default/output.html +++ b/test/fixtures/default/output.html @@ -1,3 +1,3 @@

Alpha

-

Charlie

+

Charlie

Delta