Click
  1. Click
  2. CLK-601

TextField sets size when not appropriate

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 2.1.0 RC1
    • Fix Version/s: 3.0.0
    • Component/s: core
    • Labels:
      None

      Description

      In the TextField class, the size attribute is always rendered regardless of the value of size. Since the size-attribute should be optional for the input-tag, it should be conditional, just as it is the case with maxLength and tabIndex. This would also mean that the default of 20 should be dropped.

      current code:
      buffer.appendAttribute("size", getSize());

      proposed code:
      if ( getSize() > 0 )

      { buffer.appendAttribute("size", getSize()); }

      Since the HTML-spec says size is implied, it should only be added if there is any size.

        Activity

        WarnerJan Veldhuis created issue -
        Hide
        Malcolm Edgar added a comment - - edited

        I agree with this issue, however changing this behaviour may cause some issues with existing applications. Will need to investigate potential impact.

        I presume the same applies with HTML <textarea>

        Show
        Malcolm Edgar added a comment - - edited I agree with this issue, however changing this behaviour may cause some issues with existing applications. Will need to investigate potential impact. I presume the same applies with HTML <textarea>
        Hide
        Finn Bock added a comment -

        On the browser I have tested with, the size of a <input type="text"> field seems to be 20.

        http://people.apache.org/~bckfnn/text-size.html

        In html5 the default value for size is defined as 20 (at least I think it is):

        http://www.w3.org/TR/2010/WD-html5-20100624/rendering.html#the-input-element-as-a-text-entry-widget

        So I think the suggested change is ok.

        Regarding <textarea> the default size is 20/2 on my browsers, and is defined in html5 to be 20/2:

        http://www.w3.org/TR/2010/WD-html5-20100624/the-button-element.html#attr-textarea-cols-value
        http://www.w3.org/TR/2010/WD-html5-20100624/the-button-element.html#attr-textarea-rows-value

        so doing the same on textarea will by a change from the current default values of 20/3.

        Show
        Finn Bock added a comment - On the browser I have tested with, the size of a <input type="text"> field seems to be 20. http://people.apache.org/~bckfnn/text-size.html In html5 the default value for size is defined as 20 (at least I think it is): http://www.w3.org/TR/2010/WD-html5-20100624/rendering.html#the-input-element-as-a-text-entry-widget So I think the suggested change is ok. Regarding <textarea> the default size is 20/2 on my browsers, and is defined in html5 to be 20/2: http://www.w3.org/TR/2010/WD-html5-20100624/the-button-element.html#attr-textarea-cols-value http://www.w3.org/TR/2010/WD-html5-20100624/the-button-element.html#attr-textarea-rows-value so doing the same on textarea will by a change from the current default values of 20/3.
        Hide
        Bob Schellink added a comment -

        Change seems reasonable to me as it cuts down on markup. I'd expect most application to apply a CSS width to input fields anyway which overriding the size.

        Show
        Bob Schellink added a comment - Change seems reasonable to me as it cuts down on markup. I'd expect most application to apply a CSS width to input fields anyway which overriding the size.
        Adrian A. made changes -
        Field Original Value New Value
        Fix Version/s 3.0.0 [ 12315124 ]
        Adrian A. made changes -
        Assignee Adrian A. [ a_adrian ]
        Hide
        Adrian A. added a comment -

        Fixed in Branch click-3.0.0

        Show
        Adrian A. added a comment - Fixed in Branch click-3.0.0
        Adrian A. made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Adrian A.
            Reporter:
            WarnerJan Veldhuis
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development