fix: Esc key dismisses tooltip (#1268)

fixes #1267
This commit is contained in:
Nolan Lawson 2019-06-03 19:31:00 -07:00 committed by GitHub
parent 155cb05e39
commit c397753ddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,7 @@
>
{tooltipText}
</span>
<Shortcut scope="global" key="Escape" on:pressed="dismiss()" />
<style>
.tooltip-button {
border-bottom: 1px dotted;
@ -45,6 +46,8 @@
</style>
<script>
import Shortcut from './shortcut/Shortcut.html'
let counter = 0
export default {
@ -66,7 +69,13 @@
if (e.keyCode === 32 || e.keyCode === 13) { // enter or space
this.toggle(e)
}
},
dismiss () {
this.set({ shown: false })
}
},
components: {
Shortcut
}
}
</script>