From 08e4c78e78358c2847967e9cc34b4a6497be97e2 Mon Sep 17 00:00:00 2001 From: Gô Shoemake Date: Sun, 14 Jan 2018 19:33:06 -0800 Subject: Fix column headers accessibility (#6199) * Fix accessibility of column headers As a screen reader user new to Mastodon, I encountered the following issues with the column headers as designed: * Jumping between them was difficult. FOr instance, passing my home timeline to reach notification settings was difficult to impossible, especially considering infinite scrolling. * There doesn't appear to be any means for triggering the control via the keyboard. the `titleClick` handler only responds to mouse clicks. * I didn't even realize there was a Settings toggle until I made this change. Thanks for using ARIA in your designs. It's a huge help. But adding a `button` role doesn't add keyboard handling and other button behavior. Also, because the role was on the heading container, it obscured the controls within the container itself. This fix resolve that. It also exposes the headings as headings rather than buttons, enabling skipping columns by using screen readers' heading navigation commands. Since I myself am blind, if this fix requires additional visual styling, I'd like help applying that so it can be merged. I'd consider it an essential accessibility fix for my and other blind users' existence on the platform. Thanks! * Styling fixes * Fixed overflow issue --- app/javascript/mastodon/components/column_header.js | 19 ++++++++----------- app/javascript/styles/mastodon/components.scss | 13 +++++++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js index 80a8fbdb3..c300db89b 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/mastodon/components/column_header.js @@ -23,7 +23,6 @@ export default class ColumnHeader extends React.PureComponent { icon: PropTypes.string.isRequired, active: PropTypes.bool, multiColumn: PropTypes.bool, - focusable: PropTypes.bool, showBackButton: PropTypes.bool, children: PropTypes.node, pinned: PropTypes.bool, @@ -32,10 +31,6 @@ export default class ColumnHeader extends React.PureComponent { onClick: PropTypes.func, }; - static defaultProps = { - focusable: true, - } - state = { collapsed: true, animating: false, @@ -68,7 +63,7 @@ export default class ColumnHeader extends React.PureComponent { } render () { - const { title, icon, active, children, pinned, onPin, multiColumn, focusable, showBackButton, intl: { formatMessage } } = this.props; + const { title, icon, active, children, pinned, onPin, multiColumn, showBackButton, intl: { formatMessage } } = this.props; const { collapsed, animating } = this.state; const wrapperClassName = classNames('column-header__wrapper', { @@ -135,11 +130,13 @@ export default class ColumnHeader extends React.PureComponent { return (
-

- - - {title} - +

+
{backButton} diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index dec489e9a..e8adceb66 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -2350,6 +2350,19 @@ position: relative; z-index: 2; outline: 0; + overflow: hidden; + + & > button { + display: flex; + flex: auto; + margin: 0; + border: none; + padding: 0; + color: inherit; + background: transparent; + font: inherit; + text-align: left; + } &.active { box-shadow: 0 1px 0 rgba($ui-highlight-color, 0.3); -- cgit From 2091ae92be5d04cd4dadb2200c507ce8d8d2623e Mon Sep 17 00:00:00 2001 From: neetshin Date: Mon, 15 Jan 2018 05:51:00 +0000 Subject: Make columns-area unscrollable when modal opened (#6241) * Add aria-autocomplete='list' in Textaria ref: https://www.w3.org/TR/wai-aria-1.1/#aria-autocomplete * Make detect empty string brefore assign upload description * Change code elements in keyboard-shortcuts component to kbd * Add validation for onMuteNotifications * Make columns-area unscrollable when modal opend * Make columns-area unscrollable when modal opened --- app/javascript/mastodon/features/ui/components/columns_area.js | 5 +++-- .../mastodon/features/ui/containers/columns_area_container.js | 1 + app/javascript/styles/mastodon/components.scss | 4 ++++ 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'app/javascript') diff --git a/app/javascript/mastodon/features/ui/components/columns_area.js b/app/javascript/mastodon/features/ui/components/columns_area.js index f00b74dfd..a01e5a390 100644 --- a/app/javascript/mastodon/features/ui/components/columns_area.js +++ b/app/javascript/mastodon/features/ui/components/columns_area.js @@ -37,6 +37,7 @@ export default class ColumnsArea extends ImmutablePureComponent { static propTypes = { intl: PropTypes.object.isRequired, columns: ImmutablePropTypes.list.isRequired, + isModalOpen: PropTypes.bool.isRequired, singleColumn: PropTypes.bool, children: PropTypes.node, }; @@ -144,7 +145,7 @@ export default class ColumnsArea extends ImmutablePureComponent { } render () { - const { columns, children, singleColumn } = this.props; + const { columns, children, singleColumn, isModalOpen } = this.props; const { shouldAnimate } = this.state; const columnIndex = getIndex(this.context.router.history.location.pathname); @@ -159,7 +160,7 @@ export default class ColumnsArea extends ImmutablePureComponent { } return ( -
+
{columns.map(column => { const params = column.get('params', null) === null ? null : column.get('params').toJS(); diff --git a/app/javascript/mastodon/features/ui/containers/columns_area_container.js b/app/javascript/mastodon/features/ui/containers/columns_area_container.js index 95f95618b..f3e82a8ac 100644 --- a/app/javascript/mastodon/features/ui/containers/columns_area_container.js +++ b/app/javascript/mastodon/features/ui/containers/columns_area_container.js @@ -3,6 +3,7 @@ import ColumnsArea from '../components/columns_area'; const mapStateToProps = state => ({ columns: state.getIn(['settings', 'columns']), + isModalOpen: !!state.get('modal').modalType, }); export default connect(mapStateToProps, null, null, { withRef: true })(ColumnsArea); diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index e8adceb66..dbb277af9 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -1613,6 +1613,10 @@ justify-content: flex-start; overflow-x: auto; position: relative; + + &.unscrollable { + overflow-x: hidden; + } } @media screen and (min-width: 360px) { -- cgit