toasts: hide messages on escape.
This commit is contained in:
parent
60f7192c2c
commit
36ec943b74
2 changed files with 18 additions and 0 deletions
|
|
@ -1,5 +1,6 @@
|
|||
<link rel="import" href="../../../../../../bower_components/paper-button/paper-button.html">
|
||||
<link rel="import" href="../../../../../../bower_components/paper-toast/paper-toast.html">
|
||||
<link rel="import" href="../../../../../../bower_components/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
|
||||
<link rel="import" href="../rhodecode-unsafe-html/rhodecode-unsafe-html.html">
|
||||
<dom-module id="rhodecode-toast">
|
||||
<template>
|
||||
|
|
|
|||
|
|
@ -14,12 +14,29 @@ Polymer({
|
|||
hasToasts: {
|
||||
type: Boolean,
|
||||
computed: '_computeHasToasts(toasts.*)'
|
||||
},
|
||||
keyEventTarget: {
|
||||
type: Object,
|
||||
value: function() {
|
||||
return document.body;
|
||||
}
|
||||
}
|
||||
},
|
||||
behaviors: [
|
||||
Polymer.IronA11yKeysBehavior
|
||||
],
|
||||
observers: [
|
||||
'_changedToasts(toasts.splices)'
|
||||
],
|
||||
|
||||
keyBindings: {
|
||||
'esc:keyup': '_hideOnEsc'
|
||||
},
|
||||
|
||||
_hideOnEsc: function (event) {
|
||||
return this.dismissNotifications();
|
||||
},
|
||||
|
||||
_computeHasToasts: function(){
|
||||
return this.toasts.length > 0;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue