Initial accessibility improvements

Set aria-hidden to true for cosmetic and repetitive elements
Improve channel/network aria labels in network list
Experiment with different aria-roles for landmarks
This commit is contained in:
Max Leiter 2021-04-20 18:04:31 -07:00
parent 0fb6dae8a6
commit 0aabacd549
No known key found for this signature in database
GPG key ID: A3512F2F2F17EBDA
8 changed files with 42 additions and 19 deletions

View file

@ -1,7 +1,12 @@
<template> <template>
<div id="viewport" :class="viewportClasses" role="tablist"> <div id="viewport" :class="viewportClasses" role="tablist">
<Sidebar v-if="$store.state.appLoaded" :overlay="$refs.overlay" /> <Sidebar v-if="$store.state.appLoaded" :overlay="$refs.overlay" />
<div id="sidebar-overlay" ref="overlay" @click="$store.commit('sidebarOpen', false)" /> <div
aria-hidden="true"
id="sidebar-overlay"
ref="overlay"
@click="$store.commit('sidebarOpen', false)"
/>
<router-view ref="window"></router-view> <router-view ref="window"></router-view>
<Mentions /> <Mentions />
<ImageViewer ref="imageViewer" /> <ImageViewer ref="imageViewer" />

View file

@ -52,17 +52,26 @@ export default {
methods: { methods: {
getAriaLabel() { getAriaLabel() {
const extra = []; const extra = [];
const type = this.channel.type;
if (this.channel.unread > 0) { if (this.channel.unread > 0) {
extra.push(`${this.channel.unread} unread`); if (this.channel.unread > 1) {
extra.push(`${this.channel.unread} unread messages`);
} else {
extra.push(`${this.channel.unread} unread message`);
}
} }
if (this.channel.highlight > 0) { if (this.channel.highlight > 0) {
extra.push(`${this.channel.highlight} mention`); if (this.channel.highlight > 1) {
extra.push(`${this.channel.highlight} mentions`);
} else {
extra.push(`${this.channel.highlight} mention`);
}
} }
if (extra.length > 0) { if (extra.length > 0) {
return `${this.channel.name} (${extra.join(", ")})`; return `${type}: ${this.channel.name} (${extra.join(", ")})`;
} }
return this.channel.name; return this.channel.name;

View file

@ -18,7 +18,9 @@
> >
<div class="header"> <div class="header">
<SidebarToggle /> <SidebarToggle />
<span class="title">{{ channel.name }}</span> <span class="title" :aria-label="'Currently open ' + channel.type">{{
channel.name
}}</span>
<div v-if="channel.editTopic === true" class="topic-container"> <div v-if="channel.editTopic === true" class="topic-container">
<input <input
ref="topicInput" ref="topicInput"

View file

@ -9,8 +9,12 @@
:data-command="message.command" :data-command="message.command"
:data-from="message.from && message.from.nick" :data-from="message.from && message.from.nick"
> >
<span :aria-label="messageTimeLocale" class="time tooltipped tooltipped-e" <span
>{{ messageTime }} aria-hidden="true"
:aria-label="messageTimeLocale"
class="time tooltipped tooltipped-e"
>
{{ messageTime }}
</span> </span>
<template v-if="message.type === 'unhandled'"> <template v-if="message.type === 'unhandled'">
<span class="from">[{{ message.command }}]</span> <span class="from">[{{ message.command }}]</span>
@ -40,23 +44,23 @@
<template v-else> <template v-else>
<span v-if="message.type === 'message'" class="from"> <span v-if="message.type === 'message'" class="from">
<template v-if="message.from && message.from.nick"> <template v-if="message.from && message.from.nick">
<span class="only-copy">&lt;</span> <span class="only-copy" aria-hidden="true">&lt;</span>
<Username :user="message.from" /> <Username :user="message.from" />
<span class="only-copy">&gt; </span> <span class="only-copy" aria-hidden="true">&gt; </span>
</template> </template>
</span> </span>
<span v-else-if="message.type === 'plugin'" class="from"> <span v-else-if="message.type === 'plugin'" class="from">
<template v-if="message.from && message.from.nick"> <template v-if="message.from && message.from.nick">
<span class="only-copy">[</span> <span class="only-copy" aria-hidden="true">[</span>
{{ message.from.nick }} {{ message.from.nick }}
<span class="only-copy">] </span> <span class="only-copy" aria-hidden="true">] </span>
</template> </template>
</span> </span>
<span v-else class="from"> <span v-else class="from">
<template v-if="message.from && message.from.nick"> <template v-if="message.from && message.from.nick">
<span class="only-copy">-</span> <span class="only-copy" aria-hidden="true">-</span>
<Username :user="message.from" /> <Username :user="message.from" />
<span class="only-copy">- </span> <span class="only-copy" aria-hidden="true">- </span>
</template> </template>
</span> </span>
<span class="content" dir="auto"> <span class="content" dir="auto">

View file

@ -1,8 +1,8 @@
<template> <template>
<div v-if="$store.state.networks.length === 0" class="empty"> <div v-if="$store.state.networks.length === 0" class="empty" role="navigation">
You are not connected to any networks yet. You are not connected to any networks yet.
</div> </div>
<div v-else ref="networklist"> <div v-else ref="networklist" role="navigation">
<div class="jump-to-input"> <div class="jump-to-input">
<input <input
ref="searchInput" ref="searchInput"
@ -74,6 +74,7 @@
}" }"
class="network" class="network"
role="region" role="region"
aria-live="polite"
> >
<NetworkLobby <NetworkLobby
:network="network" :network="network"

View file

@ -6,11 +6,13 @@
:src="`img/logo-${isPublic() ? 'horizontal-' : ''}transparent-bg.svg`" :src="`img/logo-${isPublic() ? 'horizontal-' : ''}transparent-bg.svg`"
class="logo" class="logo"
alt="The Lounge" alt="The Lounge"
role="presentation"
/> />
<img <img
:src="`img/logo-${isPublic() ? 'horizontal-' : ''}transparent-bg-inverted.svg`" :src="`img/logo-${isPublic() ? 'horizontal-' : ''}transparent-bg-inverted.svg`"
class="logo-inverted" class="logo-inverted"
alt="The Lounge" alt="The Lounge"
role="presentation"
/> />
<span <span
v-if="isDevelopment" v-if="isDevelopment"

View file

@ -91,7 +91,7 @@
type="checkbox" type="checkbox"
name="showSeconds" name="showSeconds"
/> />
Show seconds in timestamp Include seconds in timestamp
</label> </label>
</div> </div>
<div> <div>
@ -101,7 +101,7 @@
type="checkbox" type="checkbox"
name="use12hClock" name="use12hClock"
/> />
Show 12-hour timestamps Use 12-hour timestamps
</label> </label>
</div> </div>
<div v-if="!$store.state.serverConfiguration.public && $store.state.settings.advanced"> <div v-if="!$store.state.serverConfiguration.public && $store.state.settings.advanced">

View file

@ -52,8 +52,8 @@
<div id="loading"> <div id="loading">
<div class="window"> <div class="window">
<div id="loading-status-container"> <div id="loading-status-container">
<img src="img/logo-vertical-transparent-bg.svg" class="logo" alt="The Lounge" width="256" height="170"> <img src="img/logo-vertical-transparent-bg.svg" class="logo" alt="" width="256" height="170">
<img src="img/logo-vertical-transparent-bg-inverted.svg" class="logo-inverted" alt="The Lounge" width="256" height="170"> <img src="img/logo-vertical-transparent-bg-inverted.svg" class="logo-inverted" alt="" width="256" height="170">
<p id="loading-page-message">The Lounge requires a modern browser with JavaScript enabled.</p> <p id="loading-page-message">The Lounge requires a modern browser with JavaScript enabled.</p>
</div> </div>
<div id="loading-reload-container"> <div id="loading-reload-container">