Allow Return key to accept dialog when loading no-go areas or track as route

After ca53080e added Return key handling to the "Delete route" dialog, only
the "Load no-go areas" and "Load track as route" dialogs were still missing
similar functionality.

The implementation is based on 2a431932.

Test Plan:
- Open "Load no-go areas" or "Load track as route" dialog.
- Press Space or Return to open file dialog, choose file,
  Tab out of file input and press Return to confirm modal.
- Notice not having to Tab to the respective confirmation button.
This commit is contained in:
Henrik Fehlauer 2021-03-30 18:00:00 +00:00
parent 8b9fda47ad
commit eb8a7a9d36
2 changed files with 4 additions and 3 deletions

View file

@ -680,7 +680,7 @@
Close
</button>
<button
type="button"
type="submit"
class="btn btn-primary"
form="loadedittrackForm"
data-i18n="trackasroute.title"
@ -800,7 +800,7 @@
</button>
<button
type="button"
type="submit"
class="btn btn-primary"
form="loadNogosForm"
data-i18n="loadNogos.load"

View file

@ -191,7 +191,8 @@ BR.routeLoader = function (map, layersControl, routing, pois) {
}.bind(this)
);
L.DomUtil.get('submitLoadEditTrack').onclick = L.bind(function () {
L.DomUtil.get('submitLoadEditTrack').onclick = L.bind(function (e) {
e.preventDefault(); // prevent page reload on form submission
this._closeCanceled = false;
this.onBusyChanged(true);
if (this._testLayer.getLayers().length > 0) {