# 在新标签页中打开“键盘快捷键”会打开你点击“键盘快捷键”时所在的同一页面

**URL:** <https://meta.discourse.org/t/opening-keyboard-shortcuts-in-a-new-tab-opens-the-same-page-you-were-on-when-you-clicked-on-keyboard-shortcuts/132071>\
**Category:** UX\
**Tags:** keyboard-shortcuts\
**Created:** [2019 年10 月 28 日 15:02 UTC](https://meta.discourse.org/t/opening-keyboard-shortcuts-in-a-new-tab-opens-the-same-page-you-were-on-when-you-clicked-on-keyboard-shortcuts/132071 "2019-10-28T15:02:07Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

作者： ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)\
发布日期： [2019 年11 月 2 日 08:36 UTC](https://meta.discourse.org/t/opening-keyboard-shortcuts-in-a-new-tab-opens-the-same-page-you-were-on-when-you-clicked-on-keyboard-shortcuts/132071/5 "2019-11-02T08:36:36Z")

</div>

有道理，在 HTML5 中，没有 `href` 的锚标签是有效的。

但移除它的问题在于，这会将其从 Tab 键索引中移除，导致无法通过键盘或其他辅助输入方式访问该链接。

我们可以通过添加 `tabindex: 0` 来解决这个问题。

因此，我们可以这样做：

```plaintext
links.push({
  action: "showKeyboard",
  className: "keyboard-shortcuts-link",
  label: "keyboard_shortcuts_help.title",
  attributes: {
    tabindex: 0
  }
});

```

除非 @awesomerobot 知道移除 `href` 还存在其他问题？

---

_[View the full topic](https://meta.discourse.org/t/opening-keyboard-shortcuts-in-a-new-tab-opens-the-same-page-you-were-on-when-you-clicked-on-keyboard-shortcuts/132071)._
