Skip to content

Commit 1695605

Browse files
authored
Remove deprecated @keypress + some accessability improvements (FreeTubeApp#2697)
* remove deprecated @keypress from top-nav * remove deprecated @keypress from side-nav * add role and tabindex to new window button it could previously not be selected by tabbing over the buttons
1 parent b35d7ea commit 1695605

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/renderer/components/side-nav/side-nav.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
tabindex="0"
3939
:title="$t('Channels.Channels')"
4040
@click="navigate('subscribedchannels')"
41+
@keydown.enter.prevent="navigate('subscribedchannels')"
4142
>
4243
<div
4344
class="thumbnailContainer"
@@ -63,7 +64,7 @@
6364
tabindex="0"
6465
:title="$t('Trending.Trending')"
6566
@click="navigate('trending')"
66-
@keypress="navigate('trending')"
67+
@keydown.enter.prevent="navigate('trending')"
6768
>
6869
<div
6970
class="thumbnailContainer"
@@ -89,7 +90,7 @@
8990
tabindex="0"
9091
:title="$t('Most Popular')"
9192
@click="navigate('popular')"
92-
@keypress="navigate('popular')"
93+
@keydown.enter.prevent="navigate('popular')"
9394
>
9495
<div
9596
class="thumbnailContainer"
@@ -115,7 +116,7 @@
115116
tabindex="0"
116117
:title="$t('Playlists')"
117118
@click="navigate('userplaylists')"
118-
@keypress="navigate('userplaylists')"
119+
@keydown.enter.prevent="navigate('userplaylists')"
119120
>
120121
<div
121122
class="thumbnailContainer"
@@ -143,7 +144,7 @@
143144
tabindex="0"
144145
:title="$t('History.History')"
145146
@click="navigate('history')"
146-
@keypress="navigate('history')"
147+
@keydown.enter.prevent="navigate('history')"
147148
>
148149
<div
149150
class="thumbnailContainer"
@@ -169,7 +170,7 @@
169170
tabindex="0"
170171
:title="$t('Settings.Settings')"
171172
@click="navigate('settings')"
172-
@keypress="navigate('settings')"
173+
@keydown.enter.prevent="navigate('settings')"
173174
>
174175
<div
175176
class="thumbnailContainer"
@@ -194,7 +195,7 @@
194195
tabindex="0"
195196
:title="$t('About.About')"
196197
@click="navigate('about')"
197-
@keypress="navigate('about')"
198+
@keydown.enter.prevent="navigate('about')"
198199
>
199200
<div
200201
class="thumbnailContainer"
@@ -224,7 +225,7 @@
224225
:title="channel.name"
225226
role="button"
226227
tabindex="0"
227-
@keypress="goToChannel(channel.id)"
228+
@keydown.enter.prevent="goToChannel(channel.id)"
228229
@click="goToChannel(channel.id)"
229230
>
230231
<router-link

src/renderer/components/top-nav/top-nav.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
role="button"
1111
tabindex="0"
1212
@click="toggleSideNav"
13-
@keypress="toggleSideNav"
13+
@keydown.enter.prevent="toggleSideNav"
1414
/>
1515
<font-awesome-icon
1616
ref="historyArrowBack"
@@ -20,7 +20,7 @@
2020
tabindex="0"
2121
:title="backwardText"
2222
@click="historyBack"
23-
@keypress="historyBack"
23+
@keydown.enter.prevent="historyBack"
2424
/>
2525
<font-awesome-icon
2626
ref="historyArrowForward"
@@ -30,7 +30,7 @@
3030
tabindex="0"
3131
:title="forwardText"
3232
@click="historyForward"
33-
@keypress="historyForward"
33+
@keydown.enter.prevent="historyForward"
3434
/>
3535
<font-awesome-icon
3636
v-if="!hideSearchBar"
@@ -39,13 +39,16 @@
3939
role="button"
4040
tabindex="0"
4141
@click="toggleSearchContainer"
42-
@keypress="toggleSearchContainer"
42+
@keydown.enter.prevent="toggleSearchContainer"
4343
/>
4444
<font-awesome-icon
4545
class="navNewWindowIcon navIcon"
4646
:icon="['fas', 'clone']"
4747
:title="newWindowText"
48+
role="button"
49+
tabindex="0"
4850
@click="createNewWindow"
51+
@keydown.enter.prevent="createNewWindow"
4952
/>
5053
<div
5154
class="logo"
@@ -90,7 +93,7 @@
9093
role="button"
9194
tabindex="0"
9295
@click="showFilters = !showFilters"
93-
@keypress="showFilters = !showFilters"
96+
@keydown.enter.prevent="showFilters = !showFilters"
9497
/>
9598
</div>
9699
<ft-search-filters

0 commit comments

Comments
 (0)