feat: better keyboard navigation (#1104)

Related issue: #375
This commit is contained in:
Anton Nesterov 2021-04-27 20:29:28 +00:00 committed by GitHub
parent e4e3090153
commit 4d080babcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 1 deletions

View File

@ -12,7 +12,6 @@
text-decoration: none; text-decoration: none;
transition: 0.3s; transition: 0.3s;
border-radius: 4px; border-radius: 4px;
outline: none;
white-space: nowrap; white-space: nowrap;
font-weight: 500; font-weight: 500;
vertical-align: middle; vertical-align: middle;

View File

@ -13,6 +13,7 @@
> >
<router-link <router-link
class="thumbnailLink" class="thumbnailLink"
tabindex="-1"
:to="{ :to="{
path: `/watch/${id}`, path: `/watch/${id}`,
query: playlistId ? {playlistId} : {} query: playlistId ? {playlistId} : {}

View File

@ -7,6 +7,8 @@
<div class="inner"> <div class="inner">
<div <div
class="navOption topNavOption mobileShow" class="navOption topNavOption mobileShow"
role="button"
tabindex="0"
@click="navigate('subscriptions')" @click="navigate('subscriptions')"
> >
<font-awesome-icon <font-awesome-icon
@ -21,7 +23,10 @@
<div <div
v-if="!hideTrendingVideos" v-if="!hideTrendingVideos"
class="navOption mobileHidden" class="navOption mobileHidden"
role="button"
tabindex="0"
@click="navigate('trending')" @click="navigate('trending')"
@keypress="navigate('trending')"
> >
<font-awesome-icon <font-awesome-icon
icon="fire" icon="fire"
@ -35,7 +40,10 @@
<div <div
v-if="!hidePopularVideos" v-if="!hidePopularVideos"
class="navOption mobileHidden" class="navOption mobileHidden"
role="button"
tabindex="0"
@click="navigate('popular')" @click="navigate('popular')"
@keypress="navigate('popular')"
> >
<font-awesome-icon <font-awesome-icon
icon="users" icon="users"
@ -49,7 +57,10 @@
<div <div
v-if="!hidePlaylists" v-if="!hidePlaylists"
class="navOption mobileShow" class="navOption mobileShow"
role="button"
tabindex="0"
@click="navigate('userplaylists')" @click="navigate('userplaylists')"
@keypress="navigate('userplaylists')"
> >
<font-awesome-icon <font-awesome-icon
icon="bookmark" icon="bookmark"
@ -65,7 +76,10 @@
/> />
<div <div
class="navOption mobileShow" class="navOption mobileShow"
role="button"
tabindex="0"
@click="navigate('history')" @click="navigate('history')"
@keypress="navigate('history')"
> >
<font-awesome-icon <font-awesome-icon
icon="history" icon="history"
@ -79,7 +93,10 @@
<hr> <hr>
<div <div
class="navOption mobileShow" class="navOption mobileShow"
role="button"
tabindex="0"
@click="navigate('settings')" @click="navigate('settings')"
@keypress="navigate('settings')"
> >
<font-awesome-icon <font-awesome-icon
icon="sliders-h" icon="sliders-h"
@ -92,7 +109,10 @@
</div> </div>
<div <div
class="navOption mobileHidden" class="navOption mobileHidden"
role="button"
tabindex="0"
@click="navigate('about')" @click="navigate('about')"
@keypress="navigate('about')"
> >
<font-awesome-icon <font-awesome-icon
icon="info-circle" icon="info-circle"
@ -112,7 +132,10 @@
:key="index" :key="index"
class="navChannel mobileHidden" class="navChannel mobileHidden"
:title="channel.name" :title="channel.name"
role="button"
tabindex="0"
@click="goToChannel(channel.id)" @click="goToChannel(channel.id)"
@keypress="goToChannel(channel.id)"
> >
<div <div
class="thumbnailContainer" class="thumbnailContainer"

View File

@ -7,22 +7,34 @@
<font-awesome-icon <font-awesome-icon
class="menuIcon navIcon" class="menuIcon navIcon"
icon="bars" icon="bars"
role="button"
tabindex="0"
@click="toggleSideNav" @click="toggleSideNav"
@keypress="toggleSideNav"
/> />
<font-awesome-icon <font-awesome-icon
class="navBackIcon navIcon" class="navBackIcon navIcon"
icon="arrow-left" icon="arrow-left"
role="button"
tabindex="0"
@click="historyBack" @click="historyBack"
@keypress="historyBack"
/> />
<font-awesome-icon <font-awesome-icon
class="navForwardIcon navIcon" class="navForwardIcon navIcon"
icon="arrow-right" icon="arrow-right"
role="button"
tabindex="0"
@click="historyForward" @click="historyForward"
@keypress="historyForward"
/> />
<font-awesome-icon <font-awesome-icon
class="navSearchIcon navIcon" class="navSearchIcon navIcon"
icon="search" icon="search"
role="button"
tabindex="0"
@click="toggleSearchContainer" @click="toggleSearchContainer"
@keypress="toggleSearchContainer"
/> />
<font-awesome-icon <font-awesome-icon
class="navNewWindowIcon navIcon" class="navNewWindowIcon navIcon"
@ -52,7 +64,10 @@
<font-awesome-icon <font-awesome-icon
class="navFilterIcon navIcon" class="navFilterIcon navIcon"
icon="filter" icon="filter"
role="button"
tabindex="0"
@click="showFilters = !showFilters" @click="showFilters = !showFilters"
@keypress="showFilters = !showFilters"
/> />
</div> </div>
<ft-search-filters <ft-search-filters