Chrome Extension - first link is auto-focused in popup

后端 未结 6 1285
感动是毒
感动是毒 2021-02-07 11:18

How do I stop my Google Chrome extension\'s default action to auto-focus the first link in my popup.html? I know I could probably do some roundabout hack with JS o

6条回答
  •  借酒劲吻你
    2021-02-07 11:48

    Another easy alternative (which preserves "tabbability") is to just add an empty link () before your first actual link. It will invisibly "catch" the auto-focus from Chrome, but any users who want to tab through the links will still be able to do so normally.

    The only minor downside of this approach is that it introduces a second "dead tab" when looping; that is, users will have to press tab three times to get from the last link back to the first, instead of just twice.

提交回复
热议问题