Rob--W / browser-action-jplib

Jetpack module to add a Browser action badge to the toolbar, using the chrome.browserAction syntax from Chromium
21 stars 9 forks source link

Toolbar button "too big" in normal and small icon mode #5

Closed tmiw closed 11 years ago

tmiw commented 11 years ago

Extension: https://github.com/tmiw/newsrdr-checker Firefox 25.0 on OSX 10.9.0.

The toolbar button created by browser-action is too large regardless of icon mode. (Required for the extension to pass full review by Mozilla.) icon_16.png in the above extension's data directory is 16x16 as required, but 32x32 seems to be hardcoded in browserAction.js. There also doesn't seem to be a difference when modifying the width and height in browserActionBadge.html's CSS. Thoughts?

Rob--W commented 11 years ago

The dimensions of the button are hard-coded at https://github.com/Rob--W/browser-action-jplib/blob/master/lib/browserAction.js#L195-L201

    var tbw = require('toolbarwidget').ToolbarWidget({
        ...
        width: 32,
        height: 32,

The sdk/widget module does not offer a way to resize the button, and it does not react to height changes (moz bug 660862). The add-on SDK has "solved" the problem by setting the height of the button to 16px. If this "fix" works for you, just change 32 to 16 in the aforementioned file (and the CSS), and re-upload your add-on.

Otherwise, you will have to wait for a patch. Currently, setting the toolbar's (minimal) height is delegated to toolbarwidget. This method does not detect customization changes at the moment, because resizing a widget causes the frame's content to be reloaded (last time I checked). This doesn't matter for the browser-action library, so I could insert some methods to allow resizing.

Rob--W commented 11 years ago

I'm currently busy, so I can't look at it, at least not until Friday. If you know how to develop a solution, please see the linked issue for implementation hints and send a pull request to toolbarwidget.

Rob--W commented 11 years ago

Fixed. Update all dependencies and you will automatically get this feature without requiring any changes to your code.