Closed Bug 1153548 Opened 10 years ago Closed 9 years ago

No popupshowing event on Menu created from sdk/context-menu

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: hi, Unassigned)

References

Details

(Keywords: APIchange)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) Gecko/20100101 Firefox/40.0 Build ID: 20150411030207 Steps to reproduce: I am trying to find an equivalent of the “popupshowing” event on <menupopup> elements. Actual results: Nothing Expected results: I think the SDK should provide an equivalent, named “open” for example. As an example, the gtranslate addon [1] is based on that event, and updates the menupop after the user opens it. [1] https://addons.mozilla.org/fr/firefox/addon/gtranslate/
Keywords: APIchange
Priority: -- → P2
Actually I'm not sure if we should do this one yet, it can probably be handled by a third party module. Why is this functionality desired anyhow? perhaps there is another way to achieve what you want.
Flags: needinfo?(bonjour)
Priority: P2 → --
> Why is this functionality desired anyhow? perhaps there is another way to achieve what you want. I am trying to port the gtranslate addon to the Jetpack API, and the request happens when the gtranslate menu is opened. Of course, I don’t want to make a request everytime the context menu is opened. I am using this function for now: http://git.io/vvUfZ
Flags: needinfo?(bonjour)
(In reply to Pierre Bertet from comment #0) > User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:40.0) > Gecko/20100101 Firefox/40.0 > Build ID: 20150411030207 > > Steps to reproduce: > > I am trying to find an equivalent of the “popupshowing” event on <menupopup> > elements. > > > Actual results: > > Nothing > > > Expected results: > > I think the SDK should provide an equivalent, named “open” for example. As > an example, the gtranslate addon [1] is based on that event, and updates the > menupop after the user opens it. > > [1] https://addons.mozilla.org/fr/firefox/addon/gtranslate/ So with the `sdk/context-menu` module, let's use this example: var cm = require("sdk/context-menu"); cm.Item({ label: "A Paragraph", context: cm.SelectorContext("p"), contentScript: 'self.on("context", function (node) {' + ' console.log(node.nodeName);' + ' return true;' + '});' }); In this example the `"context"` event means that the menu is showing, and you can now decided if your context-menu should be displayed or not here, so if you `return true` here, as this example does, that thay would mean that your content-menu was just displayed. If you want something else please re-open.
Status: UNCONFIRMED → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.