Skip to content

Commit

Permalink
Move hidden editform submit button up to avoid ever having enter conf…
Browse files Browse the repository at this point in the history
…licts
  • Loading branch information
cdrini committed Apr 27, 2022
1 parent ef5892b commit 4d46f69
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions openlibrary/templates/books/edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
$var title: $this_title
$putctx("robots", "noindex,nofollow")

$# Forms will bind the "enter" key to the first submit button ; in the case
$# we show the delete button for librarians, that becomes the first submit
$# button! So we duplicate the save button here to make sure that it's always
$# the default "enter" action.
<button type="submit" class="hidden" name="_save" form="addWork" tabindex="-1"></button>

<div id="contentHead" class="editFormHead">
$code:
def find_mode():
Expand Down Expand Up @@ -34,8 +40,9 @@
note = ""
<h2 class="editFormTitle">$:title</h2>
$if ctx.user and (ctx.user.is_admin() or ctx.user.is_librarian()):
<button type="submit" class="hidden" name="_save" form="addWork" tabindex="-1"></button>
<span class="adminOnly right"><button type="submit" value="$_('Delete Record')" name="_delete" title="$_('Delete Record')" id="delete" form="addWork">$_("Delete Record")</button></span>
<span class="adminOnly right">
<button type="submit" name="_delete" id="delete" form="addWork">$_("Delete Record")</button>
</span>
$if not ctx.user:
$:render_template("lib/not_logged")
$:note
Expand Down

0 comments on commit 4d46f69

Please sign in to comment.