diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-09-08 14:34:32 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-11 10:58:48 +0200 |
commit | e78980ebd116be1ea901387c126876af902191e6 (patch) | |
tree | ea037d021e1383501e2b79add1a9581ef80a7c99 /client/src | |
parent | ecf06378ff95ec35f75de0169a02a974d2c17c62 (diff) | |
download | PeerTube-e78980ebd116be1ea901387c126876af902191e6.tar.gz PeerTube-e78980ebd116be1ea901387c126876af902191e6.tar.zst PeerTube-e78980ebd116be1ea901387c126876af902191e6.zip |
use focus-visible polyfill to improve keyboard navigation
Only the homepage is concerned, but it should have decent keyboard
navigation support now.
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/app/app.component.html | 2 | ||||
-rw-r--r-- | client/src/app/app.module.ts | 1 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.html | 4 | ||||
-rw-r--r-- | client/src/app/menu/menu.component.scss | 3 | ||||
-rw-r--r-- | client/src/app/search/search.component.html | 4 | ||||
-rw-r--r-- | client/src/app/shared/video/video-miniature.component.html | 5 | ||||
-rw-r--r-- | client/src/app/shared/video/video-thumbnail.component.scss | 5 | ||||
-rw-r--r-- | client/src/app/videos/video-list/video-overview.component.scss | 5 | ||||
-rw-r--r-- | client/src/sass/include/_mixins.scss | 4 |
9 files changed, 23 insertions, 10 deletions
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 @@ | |||
22 | <div class="sub-header-container"> | 22 | <div class="sub-header-container"> |
23 | <my-menu *ngIf="isMenuDisplayed"></my-menu> | 23 | <my-menu *ngIf="isMenuDisplayed"></my-menu> |
24 | 24 | ||
25 | <div id="right-container" class="main-col container-fluid" [ngClass]="{ expanded: isMenuDisplayed === false }"> | 25 | <div id="content" tabindex="-1" class="main-col container-fluid" [ngClass]="{ expanded: isMenuDisplayed === false }"> |
26 | 26 | ||
27 | <div class="main-row"> | 27 | <div class="main-row"> |
28 | <router-outlet></router-outlet> | 28 | <router-outlet></router-outlet> |
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' | |||
6 | import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' | 6 | import { MetaLoader, MetaModule, MetaStaticLoader, PageTitlePositioning } from '@ngx-meta/core' |
7 | import { ClipboardModule } from 'ngx-clipboard' | 7 | import { ClipboardModule } from 'ngx-clipboard' |
8 | import { HotkeyModule, IHotkeyOptions } from 'angular2-hotkeys' | 8 | import { HotkeyModule, IHotkeyOptions } from 'angular2-hotkeys' |
9 | import 'focus-visible' | ||
9 | 10 | ||
10 | import { AppRoutingModule } from './app-routing.module' | 11 | import { AppRoutingModule } from './app-routing.module' |
11 | import { AppComponent } from './app.component' | 12 | 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 @@ | |||
85 | 85 | ||
86 | <div class="footer d-flex justify-content-between"> | 86 | <div class="footer d-flex justify-content-between"> |
87 | <span class="language"> | 87 | <span class="language"> |
88 | <span (click)="openLanguageChooser()" i18n-title title="Change the language" class="icon icon-language"></span> | 88 | <span tabindex="0" (keyup.enter)="openLanguageChooser()" (click)="openLanguageChooser()" i18n-title title="Change the language" class="icon icon-language"></span> |
89 | </span> | 89 | </span> |
90 | <span class="color-palette"> | 90 | <span class="color-palette"> |
91 | <span (click)="toggleDarkTheme()" i18n-title title="Toggle dark interface" class="icon icon-moonsun"></span> | 91 | <span tabindex="0" (keyup.enter)="toggleDarkTheme()" (click)="toggleDarkTheme()" i18n-title title="Toggle dark interface" class="icon icon-moonsun"></span> |
92 | </span> | 92 | </span> |
93 | </div> | 93 | </div> |
94 | </menu> | 94 | </menu> |
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 { | |||
130 | transition: background-color .1s ease-in-out; | 130 | transition: background-color .1s ease-in-out; |
131 | @include disable-default-a-behaviour; | 131 | @include disable-default-a-behaviour; |
132 | 132 | ||
133 | &:hover { | 133 | &:hover, &.focus-visible { |
134 | background-color: rgba(255, 255, 255, 0.15); | 134 | background-color: rgba(255, 255, 255, 0.15); |
135 | } | 135 | } |
136 | 136 | ||
@@ -202,6 +202,7 @@ menu { | |||
202 | font-weight: $font-semibold; | 202 | font-weight: $font-semibold; |
203 | 203 | ||
204 | .icon { | 204 | .icon { |
205 | @include disable-outline; | ||
205 | @include icon(28px); | 206 | @include icon(28px); |
206 | opacity: 0.9; | 207 | opacity: 0.9; |
207 | 208 | ||
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 @@ | |||
48 | <my-video-thumbnail [video]="result"></my-video-thumbnail> | 48 | <my-video-thumbnail [video]="result"></my-video-thumbnail> |
49 | 49 | ||
50 | <div class="video-info"> | 50 | <div class="video-info"> |
51 | <a class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> | 51 | <a tabindex="-1" class="video-info-name" [routerLink]="['/videos/watch', result.uuid]" [attr.title]="result.name">{{ result.name }}</a> |
52 | <span i18n class="video-info-date-views">{{ result.publishedAt | myFromNow }} - {{ result.views | myNumberFormatter }} views</span> | 52 | <span i18n class="video-info-date-views">{{ result.publishedAt | myFromNow }} - {{ result.views | myNumberFormatter }} views</span> |
53 | <a class="video-info-account" [routerLink]="[ '/accounts', result.byAccount ]">{{ result.byAccount }}</a> | 53 | <a tabindex="-1" class="video-info-account" [routerLink]="[ '/accounts', result.byAccount ]">{{ result.byAccount }}</a> |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | </ng-container> | 56 | </ng-container> |
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 @@ | |||
3 | 3 | ||
4 | <div class="video-miniature-information"> | 4 | <div class="video-miniature-information"> |
5 | <a | 5 | <a |
6 | tabindex="-1" | ||
6 | class="video-miniature-name" | 7 | class="video-miniature-name" |
7 | [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }" | 8 | [routerLink]="[ '/videos/watch', video.uuid ]" [attr.title]="video.name" [ngClass]="{ 'blur-filter': isVideoBlur() }" |
8 | > | 9 | > |
@@ -11,10 +12,10 @@ | |||
11 | 12 | ||
12 | <span i18n class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span> | 13 | <span i18n class="video-miniature-created-at-views">{{ video.publishedAt | myFromNow }} - {{ video.views | myNumberFormatter }} views</span> |
13 | 14 | ||
14 | <a *ngIf="displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/accounts', video.byAccount ]"> | 15 | <a tabindex="-1" *ngIf="displayOwnerAccount()" class="video-miniature-account" [routerLink]="[ '/accounts', video.byAccount ]"> |
15 | {{ video.byAccount }} | 16 | {{ video.byAccount }} |
16 | </a> | 17 | </a> |
17 | <a *ngIf="displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/video-channels', video.byVideoChannel ]"> | 18 | <a tabindex="-1" *ngIf="displayOwnerVideoChannel()" class="video-miniature-channel" [routerLink]="[ '/video-channels', video.byVideoChannel ]"> |
18 | {{ video.byVideoChannel }} | 19 | {{ video.byVideoChannel }} |
19 | </a> | 20 | </a> |
20 | </div> | 21 | </div> |
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 @@ | |||
14 | text-decoration: none !important; | 14 | text-decoration: none !important; |
15 | } | 15 | } |
16 | 16 | ||
17 | @include disable-outline; | ||
18 | &.focus-visible { | ||
19 | box-shadow: 0 0 0 2px var(--mainColor); | ||
20 | } | ||
21 | |||
17 | img { | 22 | img { |
18 | width: $video-thumbnail-width; | 23 | width: $video-thumbnail-width; |
19 | height: $video-thumbnail-height; | 24 | 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 @@ | |||
19 | margin-bottom: 20px; | 19 | margin-bottom: 20px; |
20 | 20 | ||
21 | a { | 21 | a { |
22 | @include disable-default-a-behaviour; | 22 | &:hover, &:focus:not(.focus-visible), &:active { |
23 | text-decoration: none; | ||
24 | outline: none; | ||
25 | } | ||
23 | 26 | ||
24 | color: var(--mainForegroundColor); | 27 | color: var(--mainForegroundColor); |
25 | } | 28 | } |
diff --git a/client/src/sass/include/_mixins.scss b/client/src/sass/include/_mixins.scss index 03cb337c2..d755e7df3 100644 --- a/client/src/sass/include/_mixins.scss +++ b/client/src/sass/include/_mixins.scss | |||
@@ -8,7 +8,9 @@ | |||
8 | } | 8 | } |
9 | 9 | ||
10 | @mixin disable-outline { | 10 | @mixin disable-outline { |
11 | outline: none; | 11 | &:focus:not(.focus-visible) { |
12 | outline: none; | ||
13 | } | ||
12 | 14 | ||
13 | &::-moz-focus-inner { | 15 | &::-moz-focus-inner { |
14 | border: 0; | 16 | border: 0; |