File tree 2 files changed +17
-3
lines changed
packages/vuetify/src/components/VList
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -168,10 +168,12 @@ export default baseMixins.extend<options>().extend({
168
168
data [ this . to ? 'nativeOn' : 'on' ] = {
169
169
...data [ this . to ? 'nativeOn' : 'on' ] ,
170
170
keydown : ( e : KeyboardEvent ) => {
171
- /* istanbul ignore else */
172
- if ( e . keyCode === keyCodes . enter ) this . click ( e )
171
+ if ( ! this . disabled ) {
172
+ /* istanbul ignore else */
173
+ if ( e . keyCode === keyCodes . enter ) this . click ( e )
173
174
174
- this . $emit ( 'keydown' , e )
175
+ this . $emit ( 'keydown' , e )
176
+ }
175
177
} ,
176
178
}
177
179
Original file line number Diff line number Diff line change @@ -234,4 +234,16 @@ describe('VListItem.ts', () => {
234
234
wrapper2 . vm . toggle ( )
235
235
expect ( wrapper2 . vm . isActive ) . toBeTruthy ( )
236
236
} )
237
+
238
+ it ( 'should not react to keydown.enter when disabled' , ( ) => {
239
+ const click = jest . fn ( )
240
+ const wrapper = mountFunction ( {
241
+ methods : { click } ,
242
+ propsData : { disabled : true } ,
243
+ } )
244
+
245
+ wrapper . trigger ( 'keydown.enter' )
246
+
247
+ expect ( click ) . not . toHaveBeenCalled ( )
248
+ } )
237
249
} )
You can’t perform that action at this time.
0 commit comments