Add aria-label to column regions (#8390)

Fix #4485
master
Eugen Rochko 6 years ago committed by GitHub
parent 63484ee17a
commit 66dbb59aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      app/javascript/mastodon/components/column.js
  2. 2
      app/javascript/mastodon/features/community_timeline/index.js
  3. 3
      app/javascript/mastodon/features/compose/index.js
  4. 2
      app/javascript/mastodon/features/direct_timeline/index.js
  5. 2
      app/javascript/mastodon/features/favourited_statuses/index.js
  6. 3
      app/javascript/mastodon/features/getting_started/index.js
  7. 2
      app/javascript/mastodon/features/hashtag_timeline/index.js
  8. 2
      app/javascript/mastodon/features/home_timeline/index.js
  9. 2
      app/javascript/mastodon/features/list_timeline/index.js
  10. 2
      app/javascript/mastodon/features/notifications/index.js
  11. 2
      app/javascript/mastodon/features/public_timeline/index.js
  12. 2
      app/javascript/mastodon/features/standalone/community_timeline/index.js
  13. 2
      app/javascript/mastodon/features/standalone/public_timeline/index.js
  14. 3
      app/javascript/mastodon/features/status/index.js
  15. 66
      app/javascript/mastodon/features/trends/index.js

@ -7,6 +7,7 @@ export default class Column extends React.PureComponent {
static propTypes = { static propTypes = {
children: PropTypes.node, children: PropTypes.node,
label: PropTypes.string,
}; };
scrollTop () { scrollTop () {
@ -40,10 +41,10 @@ export default class Column extends React.PureComponent {
} }
render () { render () {
const { children } = this.props; const { label, children } = this.props;
return ( return (
<div role='region' className='column' ref={this.setRef}> <div role='region' aria-label={label} className='column' ref={this.setRef}>
{children} {children}
</div> </div>
); );

@ -105,7 +105,7 @@ export default class CommunityTimeline extends React.PureComponent {
const pinned = !!columnId; const pinned = !!columnId;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='users' icon='users'
active={hasUnread} active={hasUnread}

@ -22,6 +22,7 @@ const messages = defineMessages({
community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' }, community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' }, preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' }, logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
compose: { id: 'navigation_bar.compose', defaultMessage: 'Compose new toot' },
}); });
const mapStateToProps = (state, ownProps) => ({ const mapStateToProps = (state, ownProps) => ({
@ -95,7 +96,7 @@ export default class Compose extends React.PureComponent {
} }
return ( return (
<div className='drawer'> <div className='drawer' role='region' aria-label={intl.formatMessage(messages.compose)}>
{header} {header}
{(multiColumn || isSearchPage) && <SearchContainer /> } {(multiColumn || isSearchPage) && <SearchContainer /> }

@ -76,7 +76,7 @@ export default class DirectTimeline extends React.PureComponent {
const pinned = !!columnId; const pinned = !!columnId;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='envelope' icon='envelope'
active={hasUnread} active={hasUnread}

@ -72,7 +72,7 @@ export default class Favourites extends ImmutablePureComponent {
const pinned = !!columnId; const pinned = !!columnId;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.heading)}>
<ColumnHeader <ColumnHeader
icon='star' icon='star'
title={intl.formatMessage(messages.heading)} title={intl.formatMessage(messages.heading)}

@ -31,6 +31,7 @@ const messages = defineMessages({
discover: { id: 'navigation_bar.discover', defaultMessage: 'Discover' }, discover: { id: 'navigation_bar.discover', defaultMessage: 'Discover' },
personal: { id: 'navigation_bar.personal', defaultMessage: 'Personal' }, personal: { id: 'navigation_bar.personal', defaultMessage: 'Personal' },
security: { id: 'navigation_bar.security', defaultMessage: 'Security' }, security: { id: 'navigation_bar.security', defaultMessage: 'Security' },
menu: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
}); });
const mapStateToProps = state => ({ const mapStateToProps = state => ({
@ -115,7 +116,7 @@ export default class GettingStarted extends ImmutablePureComponent {
} }
return ( return (
<Column> <Column label={intl.formatMessage(messages.menu)}>
{multiColumn && <div className='column-header__wrapper'> {multiColumn && <div className='column-header__wrapper'>
<h1 className='column-header'> <h1 className='column-header'>
<button> <button>

@ -89,7 +89,7 @@ export default class HashtagTimeline extends React.PureComponent {
const pinned = !!columnId; const pinned = !!columnId;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={`#${id}`}>
<ColumnHeader <ColumnHeader
icon='hashtag' icon='hashtag'
active={hasUnread} active={hasUnread}

@ -98,7 +98,7 @@ export default class HomeTimeline extends React.PureComponent {
const pinned = !!columnId; const pinned = !!columnId;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='home' icon='home'
active={hasUnread} active={hasUnread}

@ -137,7 +137,7 @@ export default class ListTimeline extends React.PureComponent {
} }
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={title}>
<ColumnHeader <ColumnHeader
icon='list-ul' icon='list-ul'
active={hasUnread} active={hasUnread}

@ -165,7 +165,7 @@ export default class Notifications extends React.PureComponent {
); );
return ( return (
<Column ref={this.setColumnRef}> <Column ref={this.setColumnRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='bell' icon='bell'
active={isUnread} active={isUnread}

@ -112,7 +112,7 @@ export default class PublicTimeline extends React.PureComponent {
const pinned = !!columnId; const pinned = !!columnId;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='globe' icon='globe'
active={hasUnread} active={hasUnread}

@ -51,7 +51,7 @@ export default class CommunityTimeline extends React.PureComponent {
const { intl } = this.props; const { intl } = this.props;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='users' icon='users'
title={intl.formatMessage(messages.title)} title={intl.formatMessage(messages.title)}

@ -51,7 +51,7 @@ export default class PublicTimeline extends React.PureComponent {
const { intl } = this.props; const { intl } = this.props;
return ( return (
<Column ref={this.setRef}> <Column ref={this.setRef} label={intl.formatMessage(messages.title)}>
<ColumnHeader <ColumnHeader
icon='globe' icon='globe'
title={intl.formatMessage(messages.title)} title={intl.formatMessage(messages.title)}

@ -52,6 +52,7 @@ const messages = defineMessages({
blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' }, blockConfirm: { id: 'confirmations.block.confirm', defaultMessage: 'Block' },
revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' }, revealAll: { id: 'status.show_more_all', defaultMessage: 'Show more for all' },
hideAll: { id: 'status.show_less_all', defaultMessage: 'Show less for all' }, hideAll: { id: 'status.show_less_all', defaultMessage: 'Show less for all' },
detailedStatus: { id: 'status.detailed_status', defaultMessage: 'Detailed conversation view' },
}); });
const makeMapStateToProps = () => { const makeMapStateToProps = () => {
@ -404,7 +405,7 @@ export default class Status extends ImmutablePureComponent {
}; };
return ( return (
<Column> <Column label={intl.formatMessage(messages.detailedStatus)}>
<ColumnHeader <ColumnHeader
showBackButton showBackButton
extraButton={( extraButton={(

@ -1,66 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { connect } from 'react-redux';
import { injectIntl, defineMessages } from 'react-intl';
import Column from '../ui/components/column';
import ColumnHeader from '../../components/column_header';
import Hashtag from '../../components/hashtag';
import classNames from 'classnames';
import { fetchTrends } from '../../actions/trends';
const messages = defineMessages({
title: { id: 'trends.header', defaultMessage: 'Trending now' },
refreshTrends: { id: 'trends.refresh', defaultMessage: 'Refresh trends' },
});
const mapStateToProps = state => ({
trends: state.getIn(['trends', 'items']),
loading: state.getIn(['trends', 'isLoading']),
});
const mapDispatchToProps = dispatch => ({
fetchTrends: () => dispatch(fetchTrends()),
});
@connect(mapStateToProps, mapDispatchToProps)
@injectIntl
export default class Trends extends ImmutablePureComponent {
static propTypes = {
intl: PropTypes.object.isRequired,
trends: ImmutablePropTypes.list,
fetchTrends: PropTypes.func.isRequired,
loading: PropTypes.bool,
};
componentDidMount () {
this.props.fetchTrends();
}
handleRefresh = () => {
this.props.fetchTrends();
}
render () {
const { trends, loading, intl } = this.props;
return (
<Column>
<ColumnHeader
icon='fire'
title={intl.formatMessage(messages.title)}
extraButton={(
<button className='column-header__button' title={intl.formatMessage(messages.refreshTrends)} aria-label={intl.formatMessage(messages.refreshTrends)} onClick={this.handleRefresh}><i className={classNames('fa', 'fa-refresh', { 'fa-spin': loading })} /></button>
)}
/>
<div className='scrollable'>
{trends && trends.map(hashtag => <Hashtag key={hashtag.get('name')} hashtag={hashtag} />)}
</div>
</Column>
);
}
}
Loading…
Cancel
Save