Skip to content

Commit 8773b05

Browse files
NeurroneAntonio-Maranhao
authored andcommitted
Improve Accessibility for screen reader users (#1198)
* Navigation menu: ensure that nav links are always labelled for screen readers, regardless of whether they are visually minimized. Add labels and roles for the minimize toggle button. * Make screen readers read incoming notifications, add some missing labels in the notifications panel * render notifications in a labelled <aside> instead of a <span> * DatabaseRow: add missing labels to controls * Narrow the scope of role=main so it excludes the navigation bar
1 parent 8caf960 commit 8773b05

File tree

8 files changed

+19
-14
lines changed

8 files changed

+19
-14
lines changed

app/addons/components/components/copy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class Copy extends React.Component {
4949

5050
getClipboardElement () {
5151
if (this.props.displayType === 'icon') {
52-
return (<i className="fontawesome icon-paste"></i>);
52+
return (<i aria-hidden="true" className="fontawesome icon-paste"></i>);
5353
}
5454
return this.props.textDisplay;
5555
}
@@ -58,6 +58,7 @@ export class Copy extends React.Component {
5858
const btnClasses = this.props.displayType === 'input' ? "btn copy-button" : "copy" + " clipboard-copy-element";
5959
return (
6060
<button
61+
aria-label="Copy to Clipboard"
6162
className={btnClasses}
6263
data-clipboard-text={this.props.text}
6364
title={this.props.title}

app/addons/databases/components.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,15 @@ class DatabaseRow extends React.Component {
231231

232232
<td className="database-actions">
233233
<a className="db-actions btn fonticon-replicate set-replication-start"
234+
aria-label={`Replicate ${id}`}
234235
title={"Replicate " + name}
235236
href={"#/replication/_create/" + encodedId} />
236237
<a
238+
aria-label={`Set permissions for ${id}`}
237239
className="db-actions btn icon-lock set-permissions"
238240
title={"Set permissions for " + name} href={"#/database/" + encodedId + "/permissions"} />
239241
<a
242+
aria-label={`Delete ${id}`}
240243
className="db-actions btn icon-trash"
241244
onClick={this.showDeleteDatabaseModal.bind(this, id, encodedId)}
242245
title={'Delete ' + id} data-bypass="true" />

app/addons/fauxton/appwrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ class App extends React.Component {
6969
<GlobalNotificationsContainer />
7070
<NotificationPanelContainer />
7171
</div>
72-
<div role="main" id="main" className={mainClass}>
72+
<div id="main" className={mainClass}>
7373
<div id="app-container">
7474
<div className="wrapper">
75-
<div className="pusher">
75+
<div role="main" className="pusher">
7676
<ContentWrapper router={this.props.router} setNavbarActiveLink={this.props.setNavbarActiveLink}/>
7777
</div>
7878
<div id="primary-navbar">

app/addons/fauxton/navigation/components/Burger.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const Burger = ({toggleMenu, isMinimized}) => {
2929
'icon-signin faux-navbar__burger__icon--flipped';
3030

3131
return (
32-
<div className={burgerClasses} onClick={toggleMenu}>
33-
<i className={"faux-navbar__burger__icon " + icon}></i>
32+
<div aria-expanded={!isMinimized} aria-label="Toggle Navigation Menu" className={burgerClasses} onClick={toggleMenu} role="button" tabIndex="0">
33+
<i aria-hidden="true" className={"faux-navbar__burger__icon " + icon}></i>
3434
</div>
3535
);
3636
};

app/addons/fauxton/navigation/components/NavLink.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ import classNames from 'classnames';
1818

1919
const NavLink = ({link, active, isMinimized}) => {
2020

21+
const isActive = active === link.title;
2122
const linkClass = classNames(
2223
'faux-navbar__link',
23-
{'faux-navbar__link--active': active === link.title},
24-
{'faux-navbar__link--inactive': active !== link.title},
24+
{'faux-navbar__link--active': isActive},
25+
{'faux-navbar__link--inactive': !isActive},
2526
{'faux-navbar--wide': !isMinimized},
2627
{'faux-navbar--narrow': isMinimized}
2728
);
@@ -33,7 +34,7 @@ const NavLink = ({link, active, isMinimized}) => {
3334
let linkIcon = null;
3435
if (link.icon) {
3536
linkIcon = (
36-
<i className={classNames(
37+
<i aria-hidden="true" className={classNames(
3738
link.icon,
3839
'fonticon faux-navbar__icon',
3940
{'faux-navbar__icon-badge': link.badge})}>
@@ -42,7 +43,7 @@ const NavLink = ({link, active, isMinimized}) => {
4243
}
4344

4445
return (
45-
<a className={linkClass} href={link.href} target={link.target ? '_blank' : null} data-bypass={link.target ? 'true' : null}>
46+
<a aria-current={isActive ? "page" : null } aria-label={link.title} className={linkClass} href={link.href} target={link.target ? '_blank' : null} data-bypass={link.target ? 'true' : null}>
4647
<div data-nav-name={link.title} className="faux-navbar__itemarea">
4748
{linkIcon}
4849
{linkTitle}

app/addons/fauxton/notifications/components/GlobalNotifications.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export default class GlobalNotifications extends React.Component {
123123

124124
render() {
125125
return (
126-
<div id="global-notifications">
126+
<div id="global-notifications" role="alert">
127127
<TransitionMotion
128128
styles={this.getStyles}
129129
>

app/addons/fauxton/notifications/components/NotificationCenterPanel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ export default class NotificationCenterPanel extends React.Component {
103103
<header className="flex-layout flex-row">
104104
<span className="fonticon fonticon-bell" />
105105
<h1 className="flex-body">Notifications</h1>
106-
<button type="button" onClick={this.props.hideNotificationCenter}>×</button>
106+
<button aria-label="Hide Notifications Center" type="button" onClick={this.props.hideNotificationCenter}>×</button>
107107
</header>
108108

109-
<ul className="notification-filter flex-layout flex-row">
109+
<ul aria-label="Filters" className="notification-filter flex-layout flex-row">
110110
<li className={filterClasses.all} title="All notifications" data-filter="all"
111111
onClick={() => this.props.selectNotificationFilter('all')}>All</li>
112112
<li className={filterClasses.success} title="Success notifications" data-filter="success"

app/addons/fauxton/notifications/components/NotificationPanelWithTransition.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ export default class NotificationPanelWithTransition extends React.Component {
4747
{...this.props} />;
4848
});
4949
return (
50-
<span>
50+
<aside aria-label="Notifications">
5151
{panel}
52-
</span>
52+
</aside>
5353
);
5454
};
5555

0 commit comments

Comments
 (0)