From 56e35ab6e794fb7f0f010581aee2df55256a6167 Mon Sep 17 00:00:00 2001 From: Sorin Davidoi Date: Sat, 29 Jul 2017 01:58:53 +0200 Subject: [PATCH] Improve accessibility (part 6) (#4435) * fix(status_action_bar): Use aria-pressed for reblog and favourite button * fix(column_back_button): Keyboard accessible * fix(status_content): Make focusable and accessible * fix(dropdown_menu): Use aria-expanded instead of aria-pressed * fix(emoji_picker_dropdown): Use aria-expanded instead of aria-hidden * feat(icon_button): Add aria-expanded * fix(privacy_dropdown): Use aria-expanded instead of aria-hidden --- .../mastodon/components/column_back_button.js | 10 ++++++---- app/javascript/mastodon/components/dropdown_menu.js | 2 +- app/javascript/mastodon/components/icon_button.js | 2 ++ .../mastodon/components/status_action_bar.js | 4 ++-- app/javascript/mastodon/components/status_content.js | 6 +++++- .../compose/components/emoji_picker_dropdown.js | 2 +- .../features/compose/components/privacy_dropdown.js | 2 +- 7 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/javascript/mastodon/components/column_back_button.js b/app/javascript/mastodon/components/column_back_button.js index ba2736d7a0..5b7a89d569 100644 --- a/app/javascript/mastodon/components/column_back_button.js +++ b/app/javascript/mastodon/components/column_back_button.js @@ -8,14 +8,16 @@ export default class ColumnBackButton extends React.PureComponent { router: PropTypes.object, }; - handleClick = () => { - if (window.history && window.history.length === 1) this.context.router.history.push('/'); - else this.context.router.history.goBack(); + handleClick = (e) => { + if (!e.key || e.key === 'Enter') { + if (window.history && window.history.length === 1) this.context.router.history.push('/'); + else this.context.router.history.goBack(); + } } render () { return ( -
+
diff --git a/app/javascript/mastodon/components/dropdown_menu.js b/app/javascript/mastodon/components/dropdown_menu.js index f62a75183a..28631f4638 100644 --- a/app/javascript/mastodon/components/dropdown_menu.js +++ b/app/javascript/mastodon/components/dropdown_menu.js @@ -134,7 +134,7 @@ export default class DropdownMenu extends React.PureComponent { return ( - + diff --git a/app/javascript/mastodon/components/icon_button.js b/app/javascript/mastodon/components/icon_button.js index febdabbc02..3e5f8ac8cf 100644 --- a/app/javascript/mastodon/components/icon_button.js +++ b/app/javascript/mastodon/components/icon_button.js @@ -13,6 +13,7 @@ export default class IconButton extends React.PureComponent { size: PropTypes.number, active: PropTypes.bool, pressed: PropTypes.bool, + expanded: PropTypes.bool, style: PropTypes.object, activeStyle: PropTypes.object, disabled: PropTypes.bool, @@ -77,6 +78,7 @@ export default class IconButton extends React.PureComponent {