[Laszlo-dev] For Review: Change 20090603-hqm-U Summary: fix for text selection in DHTML

Henry Minsky hminsky at laszlosystems.com
Sun Jun 7 07:27:05 PDT 2009


Well then it must be a feature, not a bug!


On Sun, Jun 7, 2009 at 7:29 AM, André Bargull <andre.bargull at udo.edu> wrote:

> 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 the
>> nonselectable-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 <andre.bargull at udo.edu<mailto:
>> andre.bargull at udo.edu>> 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
>> hminsky at laszlosystems.com <mailto:hminsky at laszlosystems.com>
>>
>>
>>
>
>
>
> this is selectable text
>  this is nonselectable text
>
>


-- 
Henry Minsky
Software Architect
hminsky at laszlosystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-dev/attachments/20090607/c25e717a/attachment-0001.html


More information about the Laszlo-dev mailing list