Chrome扩展程序 - 第一个链接在弹出窗口中自动对焦 [英] Chrome Extension - first link is auto-focused in popup

查看:163
本文介绍了Chrome扩展程序 - 第一个链接在弹出窗口中自动对焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何停止我的Google Chrome扩展程序的默认操作,以自动将我的 popup.html 中的第一个链接聚焦?我知道我可能会用JS做一些迂回的攻击或改变:focus CSS,但我认为这是抛弃了我正在尝试做的其他事情,我宁愿停止它的根本原因。

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 or change the :focus CSS, but I think this is throwing off something else I'm trying to do and I'd prefer to stop the root cause of it.

推荐答案

最简单的方法就是简单地添加 tabindex = - 1添加到您不想接收自动焦点的元素。

The easiest (and javascript free!) way is to simply add tabindex="-1" to any element which you don't want to receive automatic focus.

这篇关于Chrome扩展程序 - 第一个链接在弹出窗口中自动对焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆