Skip to content

Commit

Permalink
Merge pull request #194 from indiana-university/feature/use-full-path…
Browse files Browse the repository at this point in the history
…-in-skip-to-content

feat(Accessibility): Use Full URL in "Skip to Content" Link Location
  • Loading branch information
burnumd authored Apr 5, 2019
2 parents 1a511e0 + 24ab8ac commit 9466bec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/components/Header/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ describe('<Header />', () => {
it('should not render the header navigation when it is not provided', () => {
expect(cut.find('HeaderNavigation')).toHaveLength(0);
});
it('should render the skip to content link with the full URL', () => {
const skipLink = cut.find('.rvt-skip-link')
expect(skipLink).toHaveLength(1);
expect(skipLink.props().href).toEqual(`${document.URL}#main-content`);
})
});

describe('Including header navigation', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const HeaderComponent: React.SFC<HeaderProps & React.HTMLAttributes<HTMLDivEleme
const navigation = findFirstChildOfType(children, Navigation.displayName);
return (
<header {...attrs} className={classNames(componentClass, className)} role="banner">
<a className="rvt-skip-link" href="#main-content">Skip to content</a>
<a className="rvt-skip-link" href={`${document.URL}#main-content`}>Skip to content</a>
<div className="rvt-header__trident">
<Icon name="trident-header" />
</div>
Expand Down

0 comments on commit 9466bec

Please sign in to comment.