mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 22:48:10 +02:00
Accept input and return to browse mode only on preset input fields
(closes #2957, better solution for #2380)
This commit is contained in:
@@ -146,14 +146,9 @@ iD.modes.Select = function(context, selectedIDs) {
|
||||
}
|
||||
}
|
||||
|
||||
function ret() {
|
||||
function esc() {
|
||||
if (!context.inIntro()) {
|
||||
// only accept changes if focused on a non-search input field.. #2912, #2380
|
||||
var el = document.activeElement,
|
||||
tagName = el && el.tagName.toLowerCase();
|
||||
if (tagName === 'input' && el.type !== 'search') {
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +164,7 @@ iD.modes.Select = function(context, selectedIDs) {
|
||||
operations.unshift(iD.operations.Delete(selectedIDs, context));
|
||||
|
||||
keybinding
|
||||
.on('⎋', ret, true)
|
||||
.on('↩', ret, true)
|
||||
.on('⎋', esc, true)
|
||||
.on('space', toggleMenu);
|
||||
|
||||
operations.forEach(function(operation) {
|
||||
|
||||
@@ -157,6 +157,12 @@ iD.ui.preset = function(context) {
|
||||
|
||||
d3.select(this)
|
||||
.call(field.input)
|
||||
.selectAll('input')
|
||||
.on('keydown', function() {
|
||||
if (d3.event.keyCode === 13) { // enter
|
||||
context.enter(iD.modes.Browse(context));
|
||||
}
|
||||
})
|
||||
.call(reference.body)
|
||||
.select('.form-label-button-wrap')
|
||||
.call(reference.button);
|
||||
|
||||
Reference in New Issue
Block a user