如何扩展 Xul 按钮并使其可聚焦?

发布于 2024-09-24 16:25:06 字数 183 浏览 2 评论 0原文

当我在 XBL 中扩展此按钮时:

<binding id="myFancyButton" extends="chrome://global/content/bindings/button.xml#button">

如何使其成为可聚焦按钮?

When I extends this button in my XBL:

<binding id="myFancyButton" extends="chrome://global/content/bindings/button.xml#button">

how do I make it a focusable button?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给妤﹃绝世温柔 2024-10-01 16:25:06

由于我不确定您的 button.xml 中有什么,

我只能提供此链接并要求您确保您的按钮遵循此处的准则:https://wiki.mozilla.org/XUL:Focus_Behaviour

特别是关于 -moz-user-focus 属性的部分很重要。

编辑:这是一个简单的 hello world 示例,按钮是可聚焦的。

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="My App" width="300" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <button label="Hello World" oncommand="alert('You pressed me')" style="max-width: 100px"/>
</window>

As I am not sure what you have in your button.xml,

I can only really provide this link and ask you to make sure your button follows the guidelines here: https://wiki.mozilla.org/XUL:Focus_Behaviour

Especially the bit about the -moz-user-focus property is important.

Edited: this is a simple hello world example, the button is focusable.

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="My App" width="300" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <button label="Hello World" oncommand="alert('You pressed me')" style="max-width: 100px"/>
</window>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文