Fix broken Return key in export route dialog

2a431932 made it possible to press `Return` to confirm the export dialog.
After 5b52abc1 this stopped working though, even when the text input had focus.

This is due to moving the `<input>` out of the `<form>` and referencing the
form's `name` attribute instead. However "The value of [the form] attribute
must be the id of a <form> in the same document" according to
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button.

Adding such an `id` restores the `Return` key to working properly.

The same change is done for the no-go form, where the same issue would otherwise
affect a later patch adding similar `Return` key handling.

Test Plan:
- Create Route, open "Export route" dialog.
- Move focus to an input field.
- Press `Return`.
- The file dialog for saving should open.
This commit is contained in:
Henrik Fehlauer 2021-03-27 18:00:00 +00:00
parent 144cc2923e
commit f31c379369

View file

@ -427,7 +427,7 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form name="export"> <form name="export" id="exportForm">
<div class="form-group row"> <div class="form-group row">
<label class="col-form-label col-sm-2" data-i18n="export.trackname">Name</label> <label class="col-form-label col-sm-2" data-i18n="export.trackname">Name</label>
<div class="col-sm-10"> <div class="col-sm-10">
@ -519,7 +519,7 @@
type="submit" type="submit"
class="btn btn-primary" class="btn btn-primary"
data-i18n="export.title" data-i18n="export.title"
form="export" form="exportForm"
id="submitExport" id="submitExport"
> >
Export route Export route
@ -712,7 +712,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
<p id="nogoError" class="invalid-feedback" style="display: none"></p> <p id="nogoError" class="invalid-feedback" style="display: none"></p>
<form name="loadNogosForm"> <form name="loadNogosForm" id="loadNogosForm">
<fieldset> <fieldset>
<legend data-i18n="loadNogos.source">Source</legend> <legend data-i18n="loadNogos.source">Source</legend>
<div> <div>