File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
packages/vuetify/src/components/VList Expand file tree Collapse file tree 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({
168168 data [ this . to ? 'nativeOn' : 'on' ] = {
169169 ...data [ this . to ? 'nativeOn' : 'on' ] ,
170170 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 )
173174
174- this . $emit ( 'keydown' , e )
175+ this . $emit ( 'keydown' , e )
176+ }
175177 } ,
176178 }
177179
Original file line number Diff line number Diff line change @@ -234,4 +234,16 @@ describe('VListItem.ts', () => {
234234 wrapper2 . vm . toggle ( )
235235 expect ( wrapper2 . vm . isActive ) . toBeTruthy ( )
236236 } )
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+ } )
237249} )
You can’t perform that action at this time.
0 commit comments