Skip to content

Commit

Permalink
Make profiles keyboard accessible
Browse files Browse the repository at this point in the history
Co-Authored-By: Jason <84899178+jasonhenriquez@users.noreply.github.com>
  • Loading branch information
ChunkyProgrammer and kommunarr committed Aug 14, 2023
1 parent ebf7e99 commit 9a13c33
Show file tree
Hide file tree
Showing 13 changed files with 60 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
'plugin:vue/recommended',
'standard',
'plugin:jsonc/recommended-with-json',
// 'plugin:vuejs-accessibility/recommended' // uncomment once issues are fixed
'plugin:vuejs-accessibility/recommended'
],

// https://eslint.org/docs/user-guide/configuring#configuring-plugins
Expand All @@ -70,6 +70,7 @@ module.exports = {
some: ['nesting', 'id']
}
}],
'vuejs-accessibility/no-static-element-interactions': 'off',
'n/no-callback-literal': 'warn',
'n/no-path-concat': 'warn',
'unicorn/better-regex': 'error',
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/ft-list-channel/ft-list-channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
<div class="channelThumbnail">
<router-link
:to="`/channel/${id}`"
tabindex="-1"
>
<img
:src="thumbnail"
class="channelImage"
alt=""
>
</router-link>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/ft-list-video/ft-list-video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<img
:src="thumbnail"
class="thumbnailImage"
alt=""
>
</router-link>
<div
Expand Down
11 changes: 10 additions & 1 deletion src/renderer/components/ft-profile-bubble/ft-profile-bubble.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineComponent } from 'vue'
import { sanitizeForHtmlId } from '../../helpers/accessibility'

export default defineComponent({
name: 'FtProfileBubble',
Expand All @@ -21,12 +22,20 @@ export default defineComponent({
}
},
computed: {
sanitizedId: function() {
return 'profileBubble' + sanitizeForHtmlId(this.profileId)
},
profileInitial: function () {
return this?.profileName?.length > 0 ? Array.from(this.profileName)[0].toUpperCase() : ''
}
},
methods: {
goToProfile: function () {
goToProfile: function (event) {
if (event instanceof KeyboardEvent) {
if (event.target.getAttribute('role') === 'link' && event.key !== 'Enter') {
return
}
}
this.$router.push({
path: `/settings/profile/edit/${this.profileId}`
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<template>
<div
class="bubblePadding"
tabindex="0"
:aria-labelledby="sanitizedId"
@click="goToProfile"
@keydown.space.prevent="goToProfile($event)"
@keydown.enter.prevent="goToProfile($event)"
>
<div
class="bubble"
Expand All @@ -11,7 +15,10 @@
{{ profileInitial }}
</div>
</div>
<div class="profileName">
<div
:id="sanitizedId"
class="profileName"
>
{{ profileName }}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
:channel-name="channel.name"
:channel-thumbnail="channel.thumbnail"
:show-selected="true"
role="button"
@click="handleChannelClick(index)"
/>
</ft-flex-box>
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/ft-profile-edit/ft-profile-edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@
v-for="(color, index) in colorValues"
:key="index"
class="colorOption"
:title="color + ' ' + $t('Profile.Custom Color')"
:style="{ background: color }"
tabindex="0"
@click="profileBgColor = color"
@keydown.space.prevent="profileBgColor = color"
@keydown.enter.prevent="profileBgColor = color"
/>
</ft-flex-box>
<ft-flex-box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
:channel-name="channel.name"
:channel-thumbnail="channel.thumbnail"
:show-selected="true"
role="button"
@click="handleChannelClick(index)"
/>
</ft-flex-box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
<div>
<div
class="colorOption"
:title="$t('Profile.Toggle Profile List')"
:style="{ background: activeProfile.bgColor, color: activeProfile.textColor }"
tabindex="0"
role="button"
@click="toggleProfileList"
@mousedown="handleIconMouseDown"
@keydown.space.prevent="toggleProfileList"
@keydown.enter.prevent="toggleProfileList"
>
<div
class="initial"
Expand All @@ -20,6 +25,7 @@
@focusout="handleProfileListFocusOut"
>
<h3
id="profileListTitle"
class="profileListTitle"
>
{{ $t("Profile.Profile Select") }}
Expand All @@ -31,12 +37,20 @@
/>
<div
class="profileWrapper"
role="listbox"
aria-labelledby="profileListTitle"
>
<div
v-for="(profile, index) in profileList"
:id="'profile-' + index"
:key="index"
class="profile"
:aria-labelledby="'profile-' + index + '-name'"
aria-selected="false"
tabindex="0"
role="option"
@click="setActiveProfile(profile)"
@keydown.enter.prevent="setActiveProfile(profile, $event)"
>
<div
class="colorOption"
Expand All @@ -49,6 +63,7 @@
</div>
</div>
<p
:id="'profile-' + index + '-name'"
class="profileName"
>
{{ profile.name }}
Expand Down
8 changes: 8 additions & 0 deletions src/renderer/views/Channel/Channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
role="tablist"
:aria-label="$t('Channel.Channel Tabs')"
>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('videos')"
id="videosTab"
Expand All @@ -99,6 +100,7 @@
>
{{ $t("Channel.Videos.Videos").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('shorts') && !hideChannelShorts"
id="shortsTab"
Expand All @@ -113,6 +115,7 @@
>
{{ $t("Global.Shorts").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('live') && !hideLiveStreams"
id="liveTab"
Expand All @@ -127,6 +130,7 @@
>
{{ $t("Channel.Live.Live").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('releases') && !hideChannelReleases"
id="releasesTab"
Expand All @@ -141,6 +145,7 @@
>
{{ $t("Channel.Releases.Releases").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('podcasts') && !hideChannelPodcasts"
id="podcastsTab"
Expand All @@ -155,6 +160,7 @@
>
{{ $t("Channel.Podcasts.Podcasts").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('playlists') && !hideChannelPlaylists"
id="playlistsTab"
Expand All @@ -169,6 +175,7 @@
>
{{ $t("Channel.Playlists.Playlists").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="tabInfoValues.includes('community') && !hideChannelCommunity"
id="communityTab"
Expand All @@ -183,6 +190,7 @@
>
{{ $t("Channel.Community.Community").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
id="aboutTab"
class="tab"
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/views/Subscriptions/Subscriptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
role="tablist"
:aria-label="$t('Subscriptions.Subscriptions Tabs')"
>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="!hideSubscriptionsVideos"
ref="videos"
Expand All @@ -22,6 +23,7 @@
>
{{ $t("Global.Videos").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="!hideSubscriptionsShorts"
ref="shorts"
Expand All @@ -37,6 +39,7 @@
>
{{ $t("Global.Shorts").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
v-if="!hideSubscriptionsLive"
ref="live"
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/views/Trending/Trending.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
role="tablist"
:aria-label="$t('Trending.Trending Tabs')"
>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
ref="default"
class="tab"
Expand All @@ -29,6 +30,7 @@
>
{{ $t("Trending.Default").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
ref="music"
class="tab"
Expand All @@ -44,6 +46,7 @@
>
{{ $t("Trending.Music").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
ref="gaming"
class="tab"
Expand All @@ -59,6 +62,7 @@
>
{{ $t("Trending.Gaming").toUpperCase() }}
</div>
<!-- eslint-disable-next-line vuejs-accessibility/interactive-supports-focus -->
<div
ref="movies"
class="tab"
Expand Down
1 change: 1 addition & 0 deletions static/locales/en-US.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ About:

Profile:
Profile Settings: Profile Settings
Toggle Profile List: Toggle Profile List
Profile Select: Profile Select
Profile Filter: Profile Filter
All Channels: All Channels
Expand Down

0 comments on commit 9a13c33

Please sign in to comment.