@@ -39,7 +39,6 @@ class Button extends React.Component {
3939
4040 getClassName ( ) {
4141 let isStateful = this . props . stateful && this . state . active ? true : false ;
42-
4342 return classNames ( this . props . className , 'slds-button' , {
4443 [ `slds-button--${ this . props . variant } ` ] : this . props . variant ,
4544 [ 'slds-is-selected' ] : isStateful ,
@@ -61,8 +60,8 @@ class Button extends React.Component {
6160 render ( ) {
6261 const props = omit ( 'className' , this . props ) ;
6362 const click = createChainedFunction ( this . props . onClick , this . onClick . bind ( this ) ) ;
64- const labelClasses = this . props . variant === 'icon' ? 'slds-assistive-text' : '' ;
6563
64+ //If the button is only an icon render this:
6665 if ( this . props . variant === 'icon' ) {
6766 return (
6867 < button className = { this . getClassName ( ) } { ...props } onClick = { click } >
@@ -72,15 +71,19 @@ class Button extends React.Component {
7271 className = { 'slds-icon' } />
7372 < span className = "slds-assistive-text" > { this . props . label } </ span >
7473 </ button >
75- )
76- } else {
74+ ) ;
75+ }
76+ //Else we assume the button has a visible label (with or without an icon):
77+ else {
7778 return (
7879 < button className = { this . getClassName ( ) } { ...props } onClick = { click } >
79- { this . props . iconPosition === 'right' ? this . props . label : null }
80+
81+ < span aria-live = "assertive" > { this . props . iconPosition === 'right' ? this . props . label : null } </ span >
8082
8183 { this . renderIcon ( ) }
8284
83- { ( this . props . iconPosition === 'left' || ! this . props . iconPosition ) ? this . props . label : null }
85+ < span aria-live = "assertive" > { ( this . props . iconPosition === 'left' || ! this . props . iconPosition ) ? this . props . label : null } </ span >
86+
8487 </ button >
8588 ) ;
8689 }
@@ -91,7 +94,7 @@ Button.propTypes = {
9194 label : React . PropTypes . string . isRequired ,
9295 variant : React . PropTypes . oneOf ( [ 'base' , 'neutral' , 'brand' , 'icon' ] ) ,
9396 iconName : React . PropTypes . string ,
94- iconSize : React . PropTypes . string ,
97+ iconSize : React . PropTypes . oneOf ( [ 'x-small' , 'small' , 'medium' , 'large' ] ) ,
9598 iconPosition : React . PropTypes . oneOf ( [ 'left' , 'right' ] ) ,
9699}
97100
0 commit comments