Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#711 closed defect (duplicate)

With PopMenu2, the currently selected text is lost

Reported by: [email protected] Owned by: cal
Priority: high Milestone:
Component: Widgets Version: 0.3
Keywords: PopMenu2, Copy, text range, selection Cc:
Blocked By: Blocking:


The test_Menu2.html document shows an example of a context menu implementation. It uses a copy/paste menu item example. In order to implement a copy of selected text, the current selection needs to be available, however in IE (6.0 tested) it is cleared before the user defined onclick event can capture it. Firefox works flawlessly. Unknown if other browsers are affected.

To recreate the problem use the follwing html fragment for the context menu (requisite dojo.require statements assumed):

<div dojoType="PopupMenu2" contextMenuForWindow="true" toggle="explode">
   <div dojoType="MenuItem2" caption="Tag Selection" onClick="tagSelection()">

The tagSelection() javascript method is:

function tagSelection()
	var txt = '';
	if (window.getSelection)
		txt = window.getSelection();
	else if (document.getSelection)
		txt = document.getSelection();
	else if (document.selection)
		txt = document.selection.createRange().text;
	else return;

	return txt;

Change History (6)

comment:1 Changed 15 years ago by anonymous

Version: 0.20.3

comment:2 Changed 15 years ago by anonymous

Milestone: 0.3release

comment:3 Changed 15 years ago by alex

Milestone: 0.3release0.3.1

comment:4 Changed 15 years ago by dylan

Owner: changed from anonymous to cal

comment:5 Changed 15 years ago by liucougar

Resolution: duplicate
Status: newclosed

duplicate of #1328


comment:6 Changed 14 years ago by (none)

Milestone: 0.4

Milestone 0.4 deleted

Note: See TracTickets for help on using tickets.