The XUL button appears to be disabled and not "pushable" (but the onclick function is called)

I am developing a Firefox extension. I am familiar with JS, CSS, XML, but new to XUL.

I want to redefine the download in such a way as to add it next to each downloaded file in order to rename it. I already did this (by placing a button and processing the renaming logic).

Remains UI. The button appears to be disabled, but apparently not, because I can click it and a popup will appear.

Here's what it looks like now:

XUL button in Firefox downloads

and corresponding code:

<xul:button label="Rename" tabindex="1" onclick="foo()"/> 

Adding disabled="false" does not help. I can add style="color:black; text-shadow:0 0;" , and this makes it look like an intent, but there are a few problems (and I think the reason may be some kind):

  • The button that I added does not โ€œpushโ€ in the same way as the built-in โ€œClear listโ€ button (clicking on it does not change the appearance, that is, it does not โ€œdropโ€). However, foo() called.
  • I cannot go to the Tab button from the keyboard.
  • I read that it is better to use command / oncommand instead of onclick (e.g. due to Tab navigation), but in my example only onclick calls foo() . The other two do not work.

If more detailed code is required (I used it completely from another extension):

  <binding id="download-done" extends="chrome://mozapps/content/downloads/download.xml#download-base"> <content> <xul:hbox flex="1"> ... <xul:vbox pack="start" flex="1"> ... <xul:hbox align="center" flex="1"> <xul:label xbl:inherits="value=status,tooltiptext=statusTip" crop="end" flex="1" class="status"/> <xul:button label="Rename" tabindex="1" onclick="foo()"/> </xul:hbox> </xul:vbox> </xul:hbox> </content> </binding> 

Help with thanks.

Change 1

The code above was taken from the original Firefox download.xml ( <binding id="download-done"> ) and changed only by adding my <xul:button> .

To make things even weirder, I took two other bindings from the same file ( <binding id="download-paused"> and <binding id="download-downloading"> ) and added the exact same <xul:button> , and in both cases, the pushed button is black (in short, normal, as it should be). It is also accessible from the keyboard using Tab , even without installing tabindex explicitly.

+4
source share

Source: https://habr.com/ru/post/1381144/


All Articles