diff --git a/assets/javascripts/app/shortcuts.coffee b/assets/javascripts/app/shortcuts.coffee index 0a9400df..56f50b5e 100644 --- a/assets/javascripts/app/shortcuts.coffee +++ b/assets/javascripts/app/shortcuts.coffee @@ -95,6 +95,8 @@ class app.Shortcuts handleKeydownAltEvent: (event) -> switch event.which + when 9 + @trigger 'altTab', event when 38 @trigger 'altUp' false diff --git a/assets/javascripts/templates/pages/help_tmpl.coffee b/assets/javascripts/templates/pages/help_tmpl.coffee index 62bef700..f2e61207 100644 --- a/assets/javascripts/templates/pages/help_tmpl.coffee +++ b/assets/javascripts/templates/pages/help_tmpl.coffee @@ -77,6 +77,9 @@ app.templates.helpPage = """

Misc

+
+ alt + tab +
Focus first link in the content area
(press tab to focus the other links)
alt + r
Reveal current page in sidebar diff --git a/assets/javascripts/views/content/content.coffee b/assets/javascripts/views/content/content.coffee index bae6130a..1ef64491 100644 --- a/assets/javascripts/views/content/content.coffee +++ b/assets/javascripts/views/content/content.coffee @@ -12,6 +12,7 @@ class app.views.Content extends app.View pageDown: 'scrollPageDown' home: 'scrollToTop' end: 'scrollToBottom' + altTab: 'onAltTab' @routes: before: 'beforeRoute' @@ -150,6 +151,11 @@ class app.views.Content extends app.View $.popup(link) return + onAltTab: (event) => + unless document.activeElement and $.hasChild @el, document.activeElement + @findByTag('a').focus() + $.stopEvent(event) + findTargetByHash: (hash) -> try $.id decodeURIComponent(hash) catch diff --git a/assets/stylesheets/components/_header.scss b/assets/stylesheets/components/_header.scss index 9cd7ec20..29ab5e0f 100644 --- a/assets/stylesheets/components/_header.scss +++ b/assets/stylesheets/components/_header.scss @@ -16,6 +16,8 @@ box-shadow: inset 0 1px rgba(white, .8), // top inner glow inset 0 -1px rgba(white, .3); // bottom inner glow @extend %user-select-none; + + a:focus { outline: 0; } } // diff --git a/assets/stylesheets/components/_path.scss b/assets/stylesheets/components/_path.scss index 88c52f2f..008bd313 100644 --- a/assets/stylesheets/components/_path.scss +++ b/assets/stylesheets/components/_path.scss @@ -17,6 +17,7 @@ @media #{$mediumScreen} { left: $sidebarMediumWidth; } ~ ._container { padding-bottom: 2rem; } + a:focus { outline: 0; } } ._path-item { diff --git a/assets/stylesheets/components/_sidebar.scss b/assets/stylesheets/components/_sidebar.scss index 96b4d7e3..606af5b3 100644 --- a/assets/stylesheets/components/_sidebar.scss +++ b/assets/stylesheets/components/_sidebar.scss @@ -33,6 +33,8 @@ border-width: 2px; } } + + a:focus { outline: 0; } } // diff --git a/assets/stylesheets/global/_base.scss b/assets/stylesheets/global/_base.scss index 06ed8977..13daa594 100644 --- a/assets/stylesheets/global/_base.scss +++ b/assets/stylesheets/global/_base.scss @@ -28,8 +28,6 @@ a { color: $linkColorHover; text-decoration: underline; } - - &:focus { outline: 0; } } img {