From 995f0ad51ca2d151291ff827c7e0b2378ff0e108 Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Sun, 23 Apr 2017 13:33:44 -0500 Subject: [PATCH] feat(cw-button): Add aria controls to CW trigger (#2303) Add an ID to the CW spoiler input field to give aria-controls a handle on it. Pass that id to the CW trigger button. Modify text icon button component to accept aria controls id value. Add aria-expanded value to text icon button to indicate when it is expanded. --- .../features/compose/components/compose_form.jsx | 2 +- .../features/compose/components/text_icon_button.jsx | 7 ++++--- .../compose/containers/spoiler_button_container.jsx | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/components/features/compose/components/compose_form.jsx b/app/assets/javascripts/components/features/compose/components/compose_form.jsx index c5ff8a5bdc2..c148dded545 100644 --- a/app/assets/javascripts/components/features/compose/components/compose_form.jsx +++ b/app/assets/javascripts/components/features/compose/components/compose_form.jsx @@ -146,7 +146,7 @@ class ComposeForm extends React.PureComponent {
- +
diff --git a/app/assets/javascripts/components/features/compose/components/text_icon_button.jsx b/app/assets/javascripts/components/features/compose/components/text_icon_button.jsx index edf413e8749..4252596c2b3 100644 --- a/app/assets/javascripts/components/features/compose/components/text_icon_button.jsx +++ b/app/assets/javascripts/components/features/compose/components/text_icon_button.jsx @@ -13,10 +13,10 @@ class TextIconButton extends React.PureComponent { } render () { - const { label, title, active } = this.props; + const { label, title, active, ariaControls } = this.props; return ( - ); @@ -28,7 +28,8 @@ TextIconButton.propTypes = { label: PropTypes.string.isRequired, title: PropTypes.string, active: PropTypes.bool, - onClick: PropTypes.func.isRequired + onClick: PropTypes.func.isRequired, + ariaControls: PropTypes.string }; export default TextIconButton; diff --git a/app/assets/javascripts/components/features/compose/containers/spoiler_button_container.jsx b/app/assets/javascripts/components/features/compose/containers/spoiler_button_container.jsx index 61ac32b857d..c54904b60ab 100644 --- a/app/assets/javascripts/components/features/compose/containers/spoiler_button_container.jsx +++ b/app/assets/javascripts/components/features/compose/containers/spoiler_button_container.jsx @@ -10,7 +10,8 @@ const messages = defineMessages({ const mapStateToProps = (state, { intl }) => ({ label: 'CW', title: intl.formatMessage(messages.title), - active: state.getIn(['compose', 'spoiler']) + active: state.getIn(['compose', 'spoiler']), + ariaControls: 'cw-spoiler-input' }); const mapDispatchToProps = dispatch => ({