From d5e197e6ea353e1d635c33b95cd342d51c5baf76 Mon Sep 17 00:00:00 2001 From: rr- Date: Mon, 22 Aug 2016 01:25:10 +0200 Subject: [PATCH] client/general: add empty href for link buttons In e464e69 I removed href='#' but I noticed that it broke some things. Readding href serves two purposes: - it makes links reachable with Tab key - it makes links clickable with Enter key The alternative to this approach was to introduce [tabindex] and [role] attributes. But not only using tabindex=0 with is questionable, it'd require adding a keyboard handler that'd intercept space and return key presses and simulated link clicks. Since it's best to leave this kind of thing to the native UI, I went with readding hrefs instead. I believe that hash hrefs, even though being a common practice, are silly, so I decided to settle down with empty hrefs. As a bonus, I added a snippet that prevents middle mouse clicks from opening such links/buttons in new tabs, which was the motivation for e464e69. --- client/html/comment.tpl | 4 ++-- client/html/comment_form.tpl | 4 ++-- client/html/expander.tpl | 2 +- client/html/fav.tpl | 4 ++-- client/html/post_edit_sidebar.tpl | 10 +++++----- client/html/post_readonly_sidebar.tpl | 8 ++++---- client/html/post_upload_row.tpl | 2 +- client/html/posts_header.tpl | 4 ++-- client/html/posts_page.tpl | 2 +- client/html/score.tpl | 6 +++--- client/html/tag_categories.tpl | 2 +- client/html/tag_category_row.tpl | 4 ++-- client/html/tag_input.tpl | 4 ++-- client/js/controls/auto_complete_control.js | 1 + client/js/controls/post_edit_sidebar_control.js | 5 +++++ client/js/controls/tag_input_control.js | 4 ++++ client/js/util/views.js | 8 ++++++++ client/js/views/post_upload_view.js | 1 + 18 files changed, 47 insertions(+), 28 deletions(-) diff --git a/client/html/comment.tpl b/client/html/comment.tpl index c0aa766b..2142ae07 100644 --- a/client/html/comment.tpl +++ b/client/html/comment.tpl @@ -32,13 +32,13 @@ --><% if (ctx.canEditComment) { %> edit<% } %><% if (ctx.canDeleteComment) { %> delete<% } %>