Skip to content

Commit

Permalink
fix(activatable): stop activator event listener propagation
Browse files Browse the repository at this point in the history
fixes #3333
  • Loading branch information
johnleider committed Jan 19, 2020
1 parent 86133ea commit be58395
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Expand Up @@ -175,4 +175,16 @@ describe('activatable.ts', () => {

document.body.removeChild(el)
})

it('should stop event propagation when activator is clicked', () => {
const wrapper = mountFunction()

const stopPropagation = jest.fn()
const onClick = { stopPropagation }
const listeners = wrapper.vm.genActivatorListeners()

listeners.click(onClick as any)

expect(stopPropagation).toHaveBeenCalled()
})
})
2 changes: 2 additions & 0 deletions packages/vuetify/src/mixins/activatable/index.ts
Expand Up @@ -109,6 +109,8 @@ export default baseMixins.extend({
const activator = this.getActivator(e)
if (activator) activator.focus()

e.stopPropagation()

this.isActive = !this.isActive
}
}
Expand Down

0 comments on commit be58395

Please sign in to comment.