After invoking a shortcut, some dialogs required pressing `Tab`
or using the mouse until focus was moved to the primary input field.
By moving the focus automatically, users can start typing right away.
This is particularly useful in conjunction with the `Return` key for
confirming the dialog.
Test Plan:
- Press `X` to open "Export" dialog:
"Name" field has focus.
- Press `Shift+O` to open "Load track as route":
"Trackfile" is focussed, file dialog opens with `Space`.
- Check "Load no-go area" dialog.
- Check "POI name" dialog.
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.
5b52abc1 copied `<label>` and `<input>` from the `loadedittrackForm` for
consistency, but missed to add some corresponding code to `NoGoAreas.js`.
After completing the implementation, the filename for loading no-go areas is now
displayed after selecting a file just like in the "Load track as route" dialog.
Test Plan:
- Open "Load no-go areas" dialog.
- Browse and select file.
- The filename should now be shown next to "Browse".
5b52abc1 broke importing no-go areas, in particular after choosing a file
and clicking on "Load" nothing would happen.
This is due to renaming the `<input>`'s `<id>` which is still referenced
in `NogoAreas.js` by its old name.
Undoing the rename resolves the issue.
Test Plan:
- Open "Load no-go areas" dialog.
- Click on "Browse" and select GeoJSON file (e.g. as referenced in #161).
- Click on "Load".
- The no-go areas should be added to the map.
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.
- "Load Track as Route" is now triggered by pressing `Shift-O`
- "Load No-Go-Areas" is now triggered by pressing `Shift-N`
- tooltip for navbar link is updated an ready for translation
After opening the "delete route" dialog the primary action button gets the
current focus. So it's possible to confirm resetting the route by pressing
"Enter".
bootbox had to be updated to to achieve this (in prior versions of bootbox the
needed callback didn't exist).
see #385