File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ const computeAttrs = (props, data) => {
8484 const nonStandardTag = isNonStandardTag ( props )
8585 const hashLink = link && props . href === '#'
8686 const role = data . attrs && data . attrs . role ? data . attrs . role : null
87+ const ariaDisabled =
88+ data . attrs && data . attrs [ 'aria-disabled' ] ? data . attrs [ 'aria-disabled' ] : null
8789 let tabindex = data . attrs ? data . attrs . tabindex : null
8890 if ( nonStandardTag || hashLink ) {
8991 tabindex = '0'
@@ -98,7 +100,7 @@ const computeAttrs = (props, data) => {
98100 // Except when link has `href` of `#`
99101 role : nonStandardTag || hashLink ? 'button' : role ,
100102 // We set the `aria-disabled` state for non-standard tags
101- 'aria-disabled' : nonStandardTag ? String ( props . disabled ) : null ,
103+ 'aria-disabled' : nonStandardTag ? String ( props . disabled ) : ariaDisabled ,
102104 // For toggles, we need to set the pressed state for ARIA
103105 'aria-pressed' : toggle ? String ( props . pressed ) : null ,
104106 // `autocomplete="off"` is needed in toggle mode to prevent some browsers
Original file line number Diff line number Diff line change @@ -176,6 +176,18 @@ describe('button', () => {
176176 wrapper . destroy ( )
177177 } )
178178
179+ it ( 'button has aria-disabled attribute when explicitly set' , ( ) => {
180+ const wrapper = mount ( BButton , {
181+ attrs : {
182+ 'aria-disabled' : 'true'
183+ }
184+ } )
185+
186+ expect ( wrapper . attributes ( 'aria-disabled' ) ) . toBe ( 'true' )
187+
188+ wrapper . destroy ( )
189+ } )
190+
179191 it ( 'link has attribute aria-disabled when disabled set' , async ( ) => {
180192 const wrapper = mount ( BButton , {
181193 propsData : {
You can’t perform that action at this time.
0 commit comments