2

I'm making a Jetpack extension in which a widget opens a panel. Clicking the widget opens the panel as expected (anchored in the lower-right corner to the widget). But if I call widget.panel.show() from my code, the panel opens detached from the widget, centered in the screen, floating in space.

In short, how can I fix this?

  1. Can I simulate a click event on the widget (somehow) instead of calling widget.panel.show()?

  2. Can I force the panel to anchor to the widget?

This question has a solution that worked in the previous Jetpack API, but I can't translate to the new interface: Using positioning 'Panel' in new Jetpack API

Community
  • 1
  • 1
Bosh
  • 8,138
  • 11
  • 51
  • 77

2 Answers2

3
panel.show(require("tab-browser").activeTab.ownerDocument.getElementById('widget:yourAddonId@package.json-yourWidgetId'));

Works for me with Addon SDK 1.8.1
Where:
yourAddonId@package.json - your addon id from package.json
yourWidgetId - your widget id

q4a
  • 31
  • 3
1
panel.show(widget)

isn't working?

ztatic
  • 1,181
  • 3
  • 13
  • 21