Skip to content

Commit

Permalink
Merge pull request #1754 from HSLdevcom/DT-2087
Browse files Browse the repository at this point in the history
DT-2087 Improve disruption info button accessibility
  • Loading branch information
lapim authored Aug 8, 2017
2 parents fb9a545 + 1776759 commit 1aa1b61
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
17 changes: 13 additions & 4 deletions app/component/AppBarLarge.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import PropTypes from 'prop-types';
import React from 'react';
import { intlShape } from 'react-intl';
import { routerShape, locationShape } from 'react-router';
import ExternalLink from './ExternalLink';
import DisruptionInfo from './DisruptionInfo';
import Icon from './Icon';
import ComponentUsageExample from './ComponentUsageExample';
import LangSelect from './LangSelect';

const AppBarLarge = ({ titleClicked }, { router, location, config }) => {
const AppBarLarge = ({ titleClicked }, { router, location, config, intl }) => {
const openDisruptionInfo = () => {
router.push({
...location,
Expand All @@ -21,21 +22,28 @@ const AppBarLarge = ({ titleClicked }, { router, location, config }) => {
return (
<div>
<div className="top-bar bp-large flex-horizontal">
<a onClick={titleClicked}>
<button className="noborder" onClick={titleClicked}>
{config.textLogo
? <section className="title">
<span className="title">
{config.title}
</span>
</section>
: <div className="navi-logo" />}
</a>
</button>
<div className="empty-space flex-grow" />
<div className="navi-languages right-border navi-margin">
<LangSelect />
</div>
<div className="navi-icons navi-margin padding-horizontal-large">
<a onClick={openDisruptionInfo}>
<a
className="noborder"
onClick={openDisruptionInfo}
aria-label={intl.formatMessage({
id: 'disruptions',
defaultMessage: 'Disruptions',
})}
>
<Icon img="icon-icon_caution" />
</a>
</div>
Expand All @@ -58,6 +66,7 @@ AppBarLarge.contextTypes = {
router: routerShape.isRequired,
location: locationShape.isRequired,
config: PropTypes.object.isRequired,
intl: intlShape.isRequired,
};

AppBarLarge.description = () =>
Expand Down
6 changes: 3 additions & 3 deletions app/component/DisruptionInfoButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import Icon from './Icon';
function DisruptionInfoButton(props, { config }) {
if (!config.disruption || config.disruption.showInfoButton) {
return (
<div
className={'cursor-pointer disruption-info'}
<button
className={'cursor-pointer disruption-info noborder'}
onClick={props.toggleDisruptionInfo}
>
<FormattedMessage id="disruptions" defaultMessage="Disruptions" />
{props.root &&
props.root.alerts &&
props.root.alerts.length > 0 &&
<Icon img={'icon-icon_caution'} className={'disruption-info'} />}
</div>
</button>
);
}
return null;
Expand Down
4 changes: 4 additions & 0 deletions app/component/navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ $content-background-color: $background-color;
padding: 5px 20px;
float: right;
}

button.noborder {
@include font-medium;
}
}

.offcanvas-section {
Expand Down
Binary file modified test/visual-images/AppBarLarge_normal/normal/ie11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1aa1b61

Please sign in to comment.