Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Text unselectable in TextBox on IE9

    We are using the raw gwt component 'TextBox' (for performance reasons) in some cases.

    Hence, on IE9, we are not able to select the text in the widget, not by dragging the mouse in it, not with ctrl+a, not with 'Select All' menu item...

    In Firefox this works correctly. IE9: text not selectable.

    What could be causing this?

    Code:
    com.google.gwt.user.client.ui.TextBox box = new com.google.gwt.user.client.ui.TextBox();
    Canvas c = new Canvas();
    c.addChild(box);
    We are on v8.3p_2012-11-30/Pro Deployment (built 2012-11-30).

    thanks
    Last edited by hin3x; 5 Feb 2013, 05:40.

    #2
    It would be a deep dive into an event system we didn't create to speculate as to a cause.

    What "performance reasons" led you to use GWT's TextBox?

    Comment


      #3
      If we use the GWT's TextBox in a no-SmartGWT environment, everything works as inspected.
      When using it inside a CanvasItem, we're experiencing odd behavior.
      I think some native browser events are blocked by SmartGWT.

      Why did we use the GWT's TextBox?
      We've created a variant of the Multi-Combox that does not size with the number of elements but allows for horizontal scrolling of his children over 1 or 2 rows. Those calculations required full functionality and speed that raw html elements can give.

      Comment


        #4
        For anybody still interested in this issue, I managed to fix it by using jQuery to bind to the "selectstart" event and simply stopPropagation() on the event in the handler. I can't really post sample code due to my particular implementation, but the general idea is:
        Code:
        // In a native method
        $wnd.$(input).on('selectstart', function(e){ e.stopPropagation(); });

        Comment


          #5
          Upon further inspection, this appears to be because SmartGWT is killing the selectstart event.

          Using: SmartClient Version: v9.0p_2014-04-01/LGPL Development Only (built 2014-04-01)

          In the SmartClient source, EventHandler.js, handleSelectStart(), approximately line 4785, the following code block is what triggers the death of the event:
          Code:
              var allowSelection = !dragging && 
                                   (mouseDownTarget != null ? 
                                      mouseDownTarget._allowNativeTextSelection() : true) &&
                                   (target != null ? 
                                      target._allowNativeTextSelection() : true);
              if (allowSelection) return true;
              return EH.killEvent();
          While doing a "drag select" the mouseDownTarget is not null and _allowNativeTextSelection() returns undefined. As a result, allowSelection = undefined so EH.killEvent() gets called.

          Comment


            #6
            I just found out that adding a handleNativeEvents="false" attribute to the <input> causes a similar experience in all browsers (not just IE). In this case, you also have to stopPropagation() on the "mousedown" event as well. Text selection was still possible using the keyboard in the other browsers, just not with the mouse.

            Comment

            Working...
            X