From 8221d7513b798615fc20c7ef0122572fbd43f583 Mon Sep 17 00:00:00 2001 From: etoledom Date: Thu, 28 Mar 2019 20:10:41 +0100 Subject: [PATCH 1/2] Improving accessibility on Mobile button component. --- packages/components/src/button/index.native.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/components/src/button/index.native.js b/packages/components/src/button/index.native.js index 176498ecd113bc..80d15295713c21 100644 --- a/packages/components/src/button/index.native.js +++ b/packages/components/src/button/index.native.js @@ -55,6 +55,7 @@ export default function Button( props ) { children, onClick, disabled, + hint, 'aria-disabled': ariaDisabled, 'aria-label': ariaLabel, 'aria-pressed': ariaPressed, @@ -66,12 +67,18 @@ export default function Button( props ) { opacity: isDisabled ? 0.2 : 1, ...( ariaPressed ? styles.buttonActive : styles.buttonInactive ), }; + let states = []; + ariaPressed && states.push( 'selected' ); + isDisabled && states.push( 'disabled' ); return ( Date: Mon, 1 Apr 2019 14:11:41 +0200 Subject: [PATCH 2/2] Fix lint issues --- packages/components/src/button/index.native.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/components/src/button/index.native.js b/packages/components/src/button/index.native.js index 80d15295713c21..7a90dd53131661 100644 --- a/packages/components/src/button/index.native.js +++ b/packages/components/src/button/index.native.js @@ -67,9 +67,15 @@ export default function Button( props ) { opacity: isDisabled ? 0.2 : 1, ...( ariaPressed ? styles.buttonActive : styles.buttonInactive ), }; - let states = []; - ariaPressed && states.push( 'selected' ); - isDisabled && states.push( 'disabled' ); + + const states = []; + if ( ariaPressed ) { + states.push( 'selected' ); + } + + if ( isDisabled ) { + states.push( 'disabled' ); + } return (