mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-20 12:43:16 +00:00
Close modals with esc or backspace
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
iD.ui.modal = function(blocking) {
|
||||
|
||||
var animate = d3.select('div.modal').empty();
|
||||
|
||||
var keybinding = d3.keybinding('modal')
|
||||
.on('⌫', close)
|
||||
.on('⎋', close);
|
||||
|
||||
d3.select(document).call(keybinding);
|
||||
|
||||
d3.select('div.modal').transition()
|
||||
.style('opacity', 0).remove();
|
||||
|
||||
@@ -30,5 +37,10 @@ iD.ui.modal = function(blocking) {
|
||||
shaded.style('opacity', 1);
|
||||
}
|
||||
|
||||
function close() {
|
||||
shaded.remove();
|
||||
keybinding.off();
|
||||
}
|
||||
|
||||
return shaded;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user