Open Bug 1515988 Opened 3 years ago Updated 1 year ago

Remove XUL buttons in favor of HTML buttons


(Toolkit :: XUL Widgets, task, P5)





(Reporter: ntim, Unassigned)


(Depends on 1 open bug, Blocks 1 open bug)


Special features of the XUL button element:

* Has a special slot for a button icon
-> That can be reproduced in HTML with a child <img> element, or as a ::before pseudo element in CSS

* Supports checked and group fields, notably for radio buttons
-> I wonder if such usages should really be buttons, maybe they should be changed to actual radios ?

* Supports a type attribute (with values disclosure/default/checkbox/radio and menu according to various sources)
-> I don't think there are any usages left of disclosure/default/checkbox/radio, so that could be removed ?
-> There's only one usage of button[type=menu], and it doesn't seem like it needs to be a button, it could be changed to a toolbarbutton or a menu element.

* Supports a dlgType attribute, it seems only used by the dialog binding, so that logic could be adapted to support HTML buttons

* Supports the open attribute, only for button[type=menu]
-> could go away with button[type=menu]

* Bug 1340643 introduced the ability to highlight button text when searching in about:preferences (button-highlightable-text). I'm not sure what to do for this, but it's worth noting it's only used in preferences.

* There's this weird accessibility feature where you can jump focus from a button to another by pressing its accesskey whilst having a button focused, it doesn't work with other elements than buttons focused, and doesn't allow jumping from a button to a checkbox either. Again, not sure what to do about this, but it seems to be implemented pretty inconsistently, since it works only on buttons.

* You can also focus a button by its accesskey using Alt+AccessKey

* There's the [default] attribute on buttons that's used consistently across the Firefox UI, that basically corresponds to the button that's focused by default in a certain context, it actually has some platform code that gives it a different native style.

* XUL buttons support a command event. It triggers when hitting space bar/enter when a button is focused, or when clicking a button.
-> The click event of HTML buttons does pretty much trigger on the same cases, so we could just use that. 

It sounds feasible to cut down the features XUL button supports and then from there convert to usages to HTML buttons or to a customized HTML button element.
Priority: -- → P5

The button binding has been converted to a XUL CE, morphing this bug to be about XUL removal.

Summary: Investigate getting rid of the button XBL binding → Remove XUL buttons in favor of HTML buttons
See Also: → 1538983
Type: enhancement → task
Blocks: de-xul-elements
No longer blocks: war-on-xbl
Depends on: 1625637
Depends on: 1626342
Depends on: 1626539
You need to log in before you can comment on or make changes to this bug.