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) => {
84
84
const nonStandardTag = isNonStandardTag ( props )
85
85
const hashLink = link && props . href === '#'
86
86
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
87
89
let tabindex = data . attrs ? data . attrs . tabindex : null
88
90
if ( nonStandardTag || hashLink ) {
89
91
tabindex = '0'
@@ -98,7 +100,7 @@ const computeAttrs = (props, data) => {
98
100
// Except when link has `href` of `#`
99
101
role : nonStandardTag || hashLink ? 'button' : role ,
100
102
// 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 ,
102
104
// For toggles, we need to set the pressed state for ARIA
103
105
'aria-pressed' : toggle ? String ( props . pressed ) : null ,
104
106
// `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', () => {
176
176
wrapper . destroy ( )
177
177
} )
178
178
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
+
179
191
it ( 'link has attribute aria-disabled when disabled set' , async ( ) => {
180
192
const wrapper = mount ( BButton , {
181
193
propsData : {
You can’t perform that action at this time.
0 commit comments