Skip to content

Commit

Permalink
snackbar: use ESC to dismiss sidebar
Browse files Browse the repository at this point in the history
Signed-off-by: Szymon Kłos <[email protected]>
Change-Id: I8f198ec3fd1ce459f9f9cce02755548224e5c721
  • Loading branch information
eszkadev committed Oct 7, 2023
1 parent e14897b commit dcb69e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions browser/src/control/Control.JSDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ L.Control.JSDialog = L.Control.extend({
.length > 0;
},

hasSnackbarOpened: function() {
return Object.keys(this.dialogs)
.filter(function (key) { return key == 'snackbar'; })
.length > 0;
},

clearDialog: function(id) {
var builder = this.dialogs[id].builder;

Expand Down
3 changes: 2 additions & 1 deletion browser/src/map/handler/Map.Keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,8 @@ L.Map.Keyboard = L.Handler.extend({
if (this._map.uiManager.isUIBlocked())
return;

if (this._map.jsdialog && this._map.jsdialog.hasDialogOpened()
if (this._map.jsdialog
&& (this._map.jsdialog.hasDialogOpened() || this._map.jsdialog.hasSnackbarOpened())
&& this._map.jsdialog.handleKeyEvent(ev)) {
ev.preventDefault();
return;
Expand Down

0 comments on commit dcb69e8

Please sign in to comment.