refactor(ui): a11y improvements

This commit is contained in:
liyasthomas
2021-08-06 21:40:26 +05:30
parent 3a96eb003b
commit 346ece94b7
31 changed files with 59 additions and 155 deletions

View File

@@ -94,11 +94,12 @@ a {
&.link { &.link {
@apply items-center; @apply items-center;
@apply px-2 py-1; @apply px-1 py-0.5;
@apply -mx-2 -my-1; @apply -mx-1 -my-0.5;
@apply text-accent; @apply text-accent;
@apply rounded;
@apply hover:text-accentDark; @apply hover:text-accentDark;
@apply focus-visible:(ring ring-inset ring-accent); @apply focus-visible:(ring ring-accent);
} }
} }
@@ -134,22 +135,10 @@ a {
font-size: var(--body-font-size); font-size: var(--body-font-size);
line-height: var(--body-line-height); line-height: var(--body-line-height);
}
&[x-placement^="top"] .tippy-tooltip .tippy-arrow { .tippy-roundarrow svg {
@apply border-t-popover; @apply fill-popover;
} }
&[x-placement^="bottom"] .tippy-tooltip .tippy-arrow {
@apply border-b-popover;
}
&[x-placement^="left"] .tippy-tooltip .tippy-arrow {
@apply border-l-popover;
}
&[x-placement^="right"] .tippy-tooltip .tippy-arrow {
@apply border-r-popover;
} }
} }

View File

@@ -26,7 +26,6 @@
<tippy <tippy
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow
@@ -97,7 +96,8 @@
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')" :title="RIGHT_SIDEBAR ? $t('hide.sidebar') : $t('show.sidebar')"
icon="menu_open" icon="menu_open"
:class="['transform rotate-180', { 'rotate-0': !RIGHT_SIDEBAR }]" class="transform rotate-180"
:class="{ 'rotate-0': !RIGHT_SIDEBAR }"
@click.native="toggleSetting('RIGHT_SIDEBAR')" @click.native="toggleSetting('RIGHT_SIDEBAR')"
/> />
</div> </div>

View File

@@ -15,21 +15,13 @@
icon="offline_bolt" icon="offline_bolt"
@click.native="showInstallPrompt()" @click.native="showInstallPrompt()"
/> />
<span tabindex="-1"> <ButtonPrimary
<ButtonPrimary v-if="currentUser === null"
v-if="currentUser === null" label="Login"
label="Login" @click.native="showLogin = true"
@click.native="showLogin = true" />
/> <span v-else>
<tippy <tippy ref="user" interactive trigger="click" theme="popover" arrow>
v-else
ref="user"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ProfilePicture <ProfilePicture
v-if="currentUser.photoURL" v-if="currentUser.photoURL"

View File

@@ -63,6 +63,7 @@ export default {
@apply justify-center; @apply justify-center;
@apply transition; @apply transition;
@apply hover:(bg-primaryDark text-secondaryDark); @apply hover:(bg-primaryDark text-secondaryDark);
@apply focus-visible:(ring ring-inset ring-accent);
.material-icons, .material-icons,
.svg-icons { .svg-icons {

View File

@@ -41,8 +41,8 @@
> >
<i <i
v-if="icon" v-if="icon"
class="material-icons"
:class="[ :class="[
'material-icons',
{ '!text-2xl': large }, { '!text-2xl': large },
label ? (reverse ? 'ml-2' : 'mr-2') : '', label ? (reverse ? 'ml-2' : 'mr-2') : '',
]" ]"
@@ -52,8 +52,8 @@
<SmartIcon <SmartIcon
v-if="svg" v-if="svg"
:name="svg" :name="svg"
class="svg-icons"
:class="[ :class="[
'svg-icons',
{ '!h-6 !w-6': large }, { '!h-6 !w-6': large },
label ? (reverse ? 'ml-2' : 'mr-2') : '', label ? (reverse ? 'ml-2' : 'mr-2') : '',
]" ]"

View File

@@ -31,8 +31,8 @@
> >
<i <i
v-if="icon" v-if="icon"
class="material-icons"
:class="[ :class="[
'material-icons',
{ '!text-2xl': large }, { '!text-2xl': large },
label ? (reverse ? 'ml-2' : 'mr-2') : '', label ? (reverse ? 'ml-2' : 'mr-2') : '',
]" ]"
@@ -42,8 +42,8 @@
<SmartIcon <SmartIcon
v-if="svg" v-if="svg"
:name="svg" :name="svg"
class="svg-icons"
:class="[ :class="[
'svg-icons',
{ '!h-6 !w-6': large }, { '!h-6 !w-6': large },
label ? (reverse ? 'ml-2' : 'mr-2') : '', label ? (reverse ? 'ml-2' : 'mr-2') : '',
]" ]"

View File

@@ -19,7 +19,6 @@
" "
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -44,14 +44,7 @@
}) })
" "
/> />
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -42,14 +42,7 @@
class="group-hover:inline-flex hidden" class="group-hover:inline-flex hidden"
@click.native="$emit('add-folder', { folder, path: folderPath })" @click.native="$emit('add-folder', { folder, path: folderPath })"
/> />
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -3,14 +3,7 @@
<template #header> <template #header>
<h3 class="heading">{{ $t("import_export") }} {{ $t("collections") }}</h3> <h3 class="heading">{{ $t("import_export") }} {{ $t("collections") }}</h3>
<div class="flex"> <div class="flex">
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<TabPrimary <TabPrimary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -49,14 +49,7 @@
class="group-hover:inline-flex hidden" class="group-hover:inline-flex hidden"
@click.native="!doc ? selectRequest() : {}" @click.native="!doc ? selectRequest() : {}"
/> />
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -62,14 +62,7 @@
}) })
" "
/> />
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -42,14 +42,7 @@
class="group-hover:inline-flex hidden" class="group-hover:inline-flex hidden"
@click.native="$emit('add-folder', { folder, path: folderPath })" @click.native="$emit('add-folder', { folder, path: folderPath })"
/> />
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -57,14 +57,7 @@
class="group-hover:inline-flex hidden" class="group-hover:inline-flex hidden"
@click.native="!doc ? selectRequest() : {}" @click.native="!doc ? selectRequest() : {}"
/> />
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -58,7 +58,6 @@
v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'" v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'"
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -39,7 +39,6 @@
v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'" v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'"
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -54,7 +54,6 @@
v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'" v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'"
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -25,14 +25,7 @@
</span> </span>
</span> </span>
<span> <span>
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -5,14 +5,7 @@
{{ $t("import_export") }} {{ $t("environments") }} {{ $t("import_export") }} {{ $t("environments") }}
</h3> </h3>
<div class="flex"> <div class="flex">
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<TabPrimary <TabPrimary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -55,7 +55,6 @@
: true : true
" "
type="button" type="button"
tabindex="-1"
:label="$t('auth.send_magic_link')" :label="$t('auth.send_magic_link')"
@click.native="signInWithEmail" @click.native="signInWithEmail"
/> />
@@ -79,9 +78,19 @@
<template #footer> <template #footer>
<p v-if="mode === 'sign-in'" class="text-secondaryLight"> <p v-if="mode === 'sign-in'" class="text-secondaryLight">
By signing in, you are agreeing to our By signing in, you are agreeing to our
<SmartAnchor class="link" to="/index" label="Terms of Service" /> <SmartAnchor
class="link"
to="https://github.com/hoppscotch/hoppscotch/wiki/Terms-&-Conditions"
blank
label="Terms of Service"
/>
and and
<SmartAnchor class="link" to="/index" label="Privacy Policy" />. <SmartAnchor
class="link"
to="https://github.com/hoppscotch/hoppscotch/wiki/Privacy-Policy"
blank
label="Privacy Policy"
/>.
</p> </p>
<p v-if="mode === 'email'" class="text-secondaryLight"> <p v-if="mode === 'email'" class="text-secondaryLight">
<SmartAnchor <SmartAnchor

View File

@@ -4,7 +4,6 @@
<tippy <tippy
ref="contentTypeOptions" ref="contentTypeOptions"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -14,7 +14,6 @@
<tippy <tippy
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -5,7 +5,6 @@
<tippy <tippy
ref="methodOptions" ref="methodOptions"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow
@@ -99,7 +98,6 @@
<tippy <tippy
ref="sendOptions" ref="sendOptions"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow
@@ -149,7 +147,6 @@
<tippy <tippy
ref="saveOptions" ref="saveOptions"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -17,10 +17,17 @@
<div class="rounded-full shadow-inner inset-0 absolute"></div> <div class="rounded-full shadow-inner inset-0 absolute"></div>
<span <span
v-if="indicator" v-if="indicator"
:class="[ class="
'border-primary rounded-full border-2 h-2.5 -top-0.5 -right-0.5 w-2.5 absolute', border-primary
indicatorStyles, rounded-full
]" border-2
h-2.5
-top-0.5
-right-0.5
w-2.5
absolute
"
:class="indicatorStyles"
></span> ></span>
</div> </div>
</template> </template>

View File

@@ -41,7 +41,6 @@
v-if="siblingDropDownIndex == index" v-if="siblingDropDownIndex == index"
ref="options" ref="options"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -1,14 +1,7 @@
<template> <template>
<span class="inline-flex"> <span class="inline-flex">
<span class="select-wrapper"> <span class="select-wrapper">
<tippy <tippy ref="language" interactive trigger="click" theme="popover" arrow>
ref="language"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -1,14 +1,7 @@
<template> <template>
<span class="inline-flex"> <span class="inline-flex">
<span class="select-wrapper"> <span class="select-wrapper">
<tippy <tippy ref="fontSize" interactive trigger="click" theme="popover" arrow>
ref="fontSize"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -8,7 +8,7 @@
:key="`tab-${index}`" :key="`tab-${index}`"
class="tab" class="tab"
:class="{ active: tab.active }" :class="{ active: tab.active }"
:tabindex="0" tabindex="0"
@keyup.enter="selectTab(tab)" @keyup.enter="selectTab(tab)"
@click="selectTab(tab)" @click="selectTab(tab)"
> >

View File

@@ -58,7 +58,6 @@
<tippy <tippy
ref="memberOptions" ref="memberOptions"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow
@@ -146,7 +145,6 @@
<tippy <tippy
ref="newMemberOptions" ref="newMemberOptions"
interactive interactive
tabindex="-1"
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow arrow

View File

@@ -25,14 +25,7 @@
</div> </div>
</div> </div>
<span> <span>
<tippy <tippy ref="options" interactive trigger="click" theme="popover" arrow>
ref="options"
interactive
tabindex="-1"
trigger="click"
theme="popover"
arrow
>
<template #trigger> <template #trigger>
<ButtonSecondary <ButtonSecondary
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"

View File

@@ -2,6 +2,8 @@ import Vue from "vue"
import VueTippy, { TippyComponent } from "vue-tippy" import VueTippy, { TippyComponent } from "vue-tippy"
Vue.use(VueTippy, { Vue.use(VueTippy, {
a11y: false,
animateFill: false, animateFill: false,
arrowType: "round",
}) })
Vue.component("Tippy", TippyComponent) Vue.component("Tippy", TippyComponent)