Closed Bug 33675 Opened 25 years ago Closed 24 years ago

[feature] Need a way to hook up context menus for XUL text inputs

Categories

(Core :: XBL, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: sfraser_bugs, Assigned: danm.moz)

References

Details

We need to be able to hook up context menus for XUL text widgets, in a way that 
is friendly to embedders.
Blocks: 14874
Yes please. Not being able to use context menus in XUL inputs would be a big
bummer, IMO.
Status: NEW → ASSIGNED
Target Milestone: --- → M17
Mass moving M17 bugs to M18
Target Milestone: M17 → M18
*** Bug 34788 has been marked as a duplicate of this bug. ***
OS: Mac System 8.5 → All
Apps folks need this in M16, retargetting, setting priority p2
Priority: P3 → P2
Target Milestone: M18 → M16
A related bug to this is bug 33967, that we need to be able to set the selection 
in XUL text widgets from JavaScript. It's related because it's another "messing 
with XUL text widgets from JS" kind of thing.
Summary: Need a way to hook up context menus for XUL text inputs → [feature] Need a way to hook up context menus for XUL text inputs
Whiteboard: 1 day, 4/26
reassigning to danm to load-balance.
Assignee: hyatt → danm
Status: ASSIGNED → NEW
Status: NEW → ASSIGNED
Whiteboard: 1 day, 4/26 → 4/28 fer sure
.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Whiteboard: 4/28 fer sure
So, dan, how do I go about hooking up a context menu to a XUL text input?

  OK. Instructions. It'd be nice if we had docs, wouldn't it?
  You've "always" been able to add popups to a specific text field in the xul, 
using a <popupset> element with an id. You wanted to be able to do it in XBL; a 
place where the id requirement gets in the way. All we've added is the ability to 
specify a popup with a magic keyword in place of the id.
  You can now add a popup to all text fields by editing the textfield's bindings:

<binding id="textfield" ...>
  <content ...>
    <xul:box ... context="_child">
       ...
      <xul:popupset>
        <xul:popup>
          <xul:menuitem value="Cut" oncommand=.../>
        </xul:popup>
      </xul:popupset>
    </xul:box>
...

The new trick is the context="_child" attribute, which makes it attach the first 
popupset child that it sees, disregarding its id.

Note that this works with everything (as far as I know) except context clicks on 
edit fields -- the exact thing you wanted. See bug 37950.
Are these instructions available off of mozilla.org/xpfe, not just in the bug?
You need to log in before you can comment on or make changes to this bug.