That seems to be the default behaviour in IE, cf. attached testcase.
On 6/6/2009 10:45 PM, Henry Minsky wrote:
What I cannot figure out is why in IE7, if you drag-select over an inputtext view, only the input text in that view gets selected, even if you wipe the mouse over the entire app, whereas if you drag-select over a selectable <text>, and wipe the mouse over the app, everything in the app gets selected.e.g., <canvas width="100%" height="80%" > <simplelayout spacing="6"/> <inputtext id="itext" y="170" width="200">This is LzInputText</inputtext> <edittext width="200">This is edittext</edittext> <edittext width="200">This is also edittext</edittext> <text selectable="true">This is selectable text</text> <text selectable="false">This is nonselectable text</text> </canvas>If you drag-select in the "This is selectable text" view, and drag the mouse over thenonselectable-text view, it adds that to the selection.If you drag-select in the edittext or the inputtext, it seems restricted to just that line of text.Is there something else we are doing in the input text sprite that keeps the other text elements from being selectable?On Sat, Jun 6, 2009 at 2:24 PM, André Bargull <[email protected] <mailto:[email protected]>> wrote:Maybe it works to cancel selection if it starts on a non-selectable element. > // prevent text selection in IE > // can't use lz.embed.attachEventHandler because we need to cancel events > if (LzSprite.prototype.quirks.ie_prevent_selection) { > document.onselectstart = function () { > var src = window.event.srcElement; > if (src.owner instanceof LzTextSprite) { > if (! src.owner.selectable) { > // Debug.write("prevent selection on non-selectable text") > return false; > } > } else { > // Debug.write("prevent selection on non-text") > return false; > } > } > } On 6/6/2009 6:27 PM, Henry Minsky wrote: And one bug in IE: Also open the component sampler, mouse down and then move cursor while still holding the mouse button. Expected: no text selection Actual: text selection for all text elements Apparently global onselectstart and ondrag were canceled in "LzInputTextSprite.js" to avoid this behaviour, cf. [3]. But having that code in LzInputTextSprite: document.onselectstart = LzTextSprite.prototype.__cancelhandler; document.ondrag = LzTextSprite.prototype.__cancelhandler; causes text selection to stop working in globally in IE7, and Safari/OSX. (Actually, inputtext selection still works in Safari for some reason with this code, but regular selectable non-input text cannot be selected ) Do you have any ideas how we can keep text selection working in IE7/Safari but not have the unwanted selection of everything? -- Henry Minsky Software Architect [email protected] <mailto:[email protected]>
this is selectable text
this is nonselectable text
