Skip to content

Commit d90bfef

Browse files
authored
Aria-label that indicates scrolling behaviour interferes in headings content for screen readers (#698)
Resolves: rdar://111006953
1 parent f5e8a34 commit d90bfef

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/components/ContentNode/LinkableHeading.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
v-if="shouldLink"
1818
:to="{ hash: `#${anchor}` }"
1919
class="header-anchor"
20-
aria-label="Scroll to section"
2120
@click="handleFocusAndScroll(anchor)"
2221
>
2322
<slot />
23+
<span class="visuallyhidden" >{{ $t('accessibility.in-page-link') }}</span>
2424
<LinkIcon class="icon" aria-hidden="true" />
2525
</router-link>
2626
<template v-else>
@@ -89,8 +89,10 @@ $icon-margin: 7px;
8989
margin-left: $icon-margin;
9090
}
9191
92-
&:hover .icon {
93-
display: inline;
92+
&:hover, &:focus {
93+
.icon {
94+
display: inline;
95+
}
9496
}
9597
}
9698
</style>

src/lang/locales/en-US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@
182182
"start": "start of code block",
183183
"end": "end of code block"
184184
},
185-
"skip-navigation": "Skip Navigation"
185+
"skip-navigation": "Skip Navigation",
186+
"in-page-link": "in page link"
186187
},
187188
"select-language": "Select the language for this page",
188189
"icons": {

tests/unit/components/ContentNode/LinkableHeading.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('LinkableHeading', () => {
4848
expect(wrapper.attributes('id')).toBe('title');
4949
const headerAnchor = wrapper.find('.header-anchor');
5050
expect(headerAnchor.props('to')).toEqual({ hash: '#title' });
51-
expect(headerAnchor.text()).toBe('Title');
51+
expect(headerAnchor.text()).toBe('Title accessibility.in-page-link');
5252
});
5353

5454
it('does not render anchor if there is no anchor', () => {

0 commit comments

Comments
 (0)