From e78980ebd116be1ea901387c126876af902191e6 Mon Sep 17 00:00:00 2001 From: Rigel Kent Date: Sat, 8 Sep 2018 14:34:32 +0200 Subject: use focus-visible polyfill to improve keyboard navigation Only the homepage is concerned, but it should have decent keyboard navigation support now. --- client/src/app/app.component.html | 2 +- client/src/app/app.module.ts | 1 + client/src/app/menu/menu.component.html | 4 ++-- client/src/app/menu/menu.component.scss | 3 ++- client/src/app/search/search.component.html | 4 ++-- client/src/app/shared/video/video-miniature.component.html | 5 +++-- client/src/app/shared/video/video-thumbnail.component.scss | 5 +++++ client/src/app/videos/video-list/video-overview.component.scss | 5 ++++- 8 files changed, 20 insertions(+), 9 deletions(-) (limited to 'client/src/app') diff --git a/client/src/app/app.component.html b/client/src/app/app.component.html index 20e573de1..23ed04c2d 100644 --- a/client/src/app/app.component.html +++ b/client/src/app/app.component.html @@ -22,7 +22,7 @@
-
+
diff --git a/client/src/app/app.module.ts b/client/src/app/app.module.ts index b484a89e8..ba16c072e 100644 --- a/client/src/app/app.module.ts +++ b/client/src/app/app.module.ts @@ -6,6 +6,7 @@ import { ResetPasswordModule } from '@app/reset-password' import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' import { ClipboardModule } from 'ngx-clipboard' import { HotkeyModule, IHotkeyOptions } from 'angular2-hotkeys' +import 'focus-visible' import { AppRoutingModule } from './app-routing.module' import { AppComponent } from './app.component' diff --git a/client/src/app/menu/menu.component.html b/client/src/app/menu/menu.component.html index 63ff4a86f..139664534 100644 --- a/client/src/app/menu/menu.component.html +++ b/client/src/app/menu/menu.component.html @@ -85,10 +85,10 @@ diff --git a/client/src/app/menu/menu.component.scss b/client/src/app/menu/menu.component.scss index 592860e12..f1b0a284f 100644 --- a/client/src/app/menu/menu.component.scss +++ b/client/src/app/menu/menu.component.scss @@ -130,7 +130,7 @@ menu { transition: background-color .1s ease-in-out; @include disable-default-a-behaviour; - &:hover { + &:hover, &.focus-visible { background-color: rgba(255, 255, 255, 0.15); } @@ -202,6 +202,7 @@ menu { font-weight: $font-semibold; .icon { + @include disable-outline; @include icon(28px); opacity: 0.9; diff --git a/client/src/app/search/search.component.html b/client/src/app/search/search.component.html index a258d4edd..c4072b291 100644 --- a/client/src/app/search/search.component.html +++ b/client/src/app/search/search.component.html @@ -48,9 +48,9 @@
- {{ result.name }} + {{ result.name }} {{ result.publishedAt | myFromNow }} - {{ result.views | myNumberFormatter }} views - +
diff --git a/client/src/app/shared/video/video-miniature.component.html b/client/src/app/shared/video/video-miniature.component.html index de84bccf9..9cf3fb321 100644 --- a/client/src/app/shared/video/video-miniature.component.html +++ b/client/src/app/shared/video/video-miniature.component.html @@ -3,6 +3,7 @@ diff --git a/client/src/app/shared/video/video-thumbnail.component.scss b/client/src/app/shared/video/video-thumbnail.component.scss index c3cb1ec75..1dd8e5338 100644 --- a/client/src/app/shared/video/video-thumbnail.component.scss +++ b/client/src/app/shared/video/video-thumbnail.component.scss @@ -14,6 +14,11 @@ text-decoration: none !important; } + @include disable-outline; + &.focus-visible { + box-shadow: 0 0 0 2px var(--mainColor); + } + img { width: $video-thumbnail-width; height: $video-thumbnail-height; diff --git a/client/src/app/videos/video-list/video-overview.component.scss b/client/src/app/videos/video-list/video-overview.component.scss index f5508cf61..eca8b230f 100644 --- a/client/src/app/videos/video-list/video-overview.component.scss +++ b/client/src/app/videos/video-list/video-overview.component.scss @@ -19,7 +19,10 @@ margin-bottom: 20px; a { - @include disable-default-a-behaviour; + &:hover, &:focus:not(.focus-visible), &:active { + text-decoration: none; + outline: none; + } color: var(--mainForegroundColor); } -- cgit v1.2.3