Skip to content

Inhibiting text-transform in form fields #1310

Closed

Activity

  1. added
    topic: rendering
    on May 24, 2016
  2. zcorpan commented on May 24, 2016

    @zcorpan
    Member

    So... what do we want for button and select?

  3. SimonSapin commented on May 24, 2016

    @SimonSapin
    ContributorAuthor

    According to the blog post linked above that’s where there is currently no interop. I don’t have an opinion.

    CC @Manishearth, @Ms2ger

  4. domenic commented on May 24, 2016

    @domenic
    Member

    Being consistent across all form fields seems nicer, if we have the option.

  5. zcorpan commented on May 24, 2016

    @zcorpan
    Member

    Yeah, that's also what people decided for normalize.css.

  6. Manishearth commented on May 24, 2016

    @Manishearth

    I'd like to be uniform too. @annevk thoughts on changing Firefox's user-agent CSS?

    Otherwise, we could add a non-normative suggestion for button and select.

  7. jdm commented on May 24, 2016

    @jdm
    Member

    Related to #1046.

  8. annevk commented on May 24, 2016

    @annevk
    Member

    @dbaron should probably decide on this for Gecko. Seems fine to me.

  9. added
    topic: forms
    on Oct 21, 2018
  10. jugglinmike commented on May 30, 2019

    @jugglinmike
    Contributor

    Three years later, and the situation originally described in that 2012 blog post hasn't changed:

      <select> <button>
    IE 11 none inherit
    IE 6 none inherit
    Edge 18 none inherit
    Edge 15 none inherit
    Chrome 74 none none
    Chrome 37 none none
    Safari 12 none none
    Safari 4 none none
    Firefox 67 inherit inherit
    Firefox 11 inherit inherit

    A quick look through some popular "CSS normalization" projects turns up text-transform: none in three different places: normalize.css, sanitize.css, and marx.

    @dbaron you've been nominated to weigh in on this from Gecko's perspective. Would you mind letting us know what you think of disabling text-transform for these elements?

  11. dbaron commented on Jun 3, 2019

    @dbaron
    Member

    I guess it seems fine to have text-transform: none on button and select. In Gecko it was originally there for input and textarea so that what users typed in text inputs didn't get transformed (see commit and bug), but since input is so many things it was broader than that. Given that breadth, it seems fine to extend to button and select if that helps compatibility.

  12. 3 remaining items

  13. tkent-google commented on Jun 12, 2019

    @tkent-google
    Contributor

    IMO, it's ok to remove text-transform:none from <button>.

  14. zcorpan commented on Jun 18, 2019

    @zcorpan
    Member

    @hober can you comment on whether this change (remove text-transform:none from <button> in the UA stylesheet) is OK for webkit?

  15. rniwa commented on Jun 18, 2019

    @rniwa

    Hm... WebKit also applies a bunch of other styles to button:

    input, textarea, keygen, select, button {
        margin: 0__qem;
    #if !(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY); // i.e. only in iOS
        font: -webkit-small-control;
    #endif
        color: initial;
        letter-spacing: normal;
        word-spacing: normal;
        line-height: normal;
        text-transform: none;
        text-indent: 0;
        text-shadow: none;
        display: inline-block;
        text-align: start;
    }
  16. zcorpan commented on Jun 20, 2019

    @zcorpan
    Member

    Yes, indeed.

    Firefox has text-indent: 0 which matches what is currently in the spec, but also sets some other properties like white-space, line-height, color...

    https://dxr.mozilla.org/mozilla-central/source/layout/style/res/forms.css?rev=e56017a57ea7#632

    Also, there are other non-replaced elements that reset some styles, such as table sets text-indent: initial per spec.

    So I think the question is: do we want to minimize the properties for button (like Firefox), or take the shortest path to interop? I don't have a strong opinion, but since interop is the main motivation for this change, it would be bad to end up with 2 engines making changes and 1 engine still being different.

  17. zcorpan commented on Aug 13, 2019

    @zcorpan
    Member

    Test for text-transform and text-indent for all elements, to find which elements are reset in the UA stylesheet in different browser engines:

    http://software.hixie.ch/utilities/js/live-dom-viewer/saved/7113

    Test case Blink Gecko WebKit
    text-transform reset button input select textarea input textarea button input select textarea keygen
    text-indent reset button input rt ruby select textarea button input optgroup option select table textarea button input rt ruby select textarea keygen
  18. zcorpan commented on Aug 13, 2019

    @zcorpan
    Member

    OK here's a test that tests more properties, but only outputs cases where the UA style is "initial"

    http://software.hixie.ch/utilities/js/live-dom-viewer/saved/7115

    Blink

    log: letter-spacing: button input select textarea
    log: word-spacing: button input select textarea
    log: line-height: button input rt select textarea
    log: text-transform: button input select textarea
    log: text-indent: button input rt ruby select textarea
    log: text-shadow: button input select textarea
    log: color: dialog html input mark select textarea
    log: text-align: input select textarea marquee
    

    Gecko

    log: color: button dialog input mark select textarea
    log: line-height: button input optgroup option select textarea
    log: text-indent: button input optgroup option select table textarea
    log: text-shadow: button input select textarea
    log: letter-spacing: input textarea
    log: word-spacing: input textarea
    log: text-transform: input textarea
    log: text-align: input select textarea marquee
    

    WebKit

    log: font-family: a abbr address area article aside audio b base bdi bdo blockquote body br canvas caption cite col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img ins label legend li link main map mark menu meta meter nav noscript object ol optgroup option output p param picture progress q rp rt ruby s script section slot small source span strong style sub summary sup table tbody td template tfoot th thead time title tr track u ul var video wbr autonomous-custom-elements applet acronym bgsound dir frame frameset noframes isindex menuitem nextid noembed rb rtc strike basefont big blink center font marquee multicol nobr spacer
    log: letter-spacing: button input select textarea keygen
    log: word-spacing: button input select textarea keygen
    log: text-transform: button input select textarea keygen
    log: text-indent: button input rt ruby select textarea keygen
    log: text-shadow: button input select textarea keygen
    log: color: html input mark textarea keygen
    log: text-align: input select textarea keygen marquee
    

    (Not sure why WebKit gives that result for font-family... Edit: filed w3c/csswg-drafts#4192 )

  19. zcorpan commented on Aug 13, 2019

    @zcorpan
    Member

    Changing things in the UA stylesheet comes with the risk of regressing rendering in existing Web content. Therefore, I would suggest taking the shortest path to interop, unless there is evidence that a different change is low risk or all implementers are on-board with the change.

    (Let's ignore keygen for the purpose of this issue, on the assumption that it will be removed from WebKit eventually. https://bugs.webkit.org/show_bug.cgi?id=167018 )

    (I will also ignore rt and ruby for now, as those have special behavior per https://drafts.csswg.org/css-ruby/ and I don't want to analyze how that interacts with UA styles right now.)

    The shortest path to interop, for each property, I think is something like this:

    (proposal)

    letter-spacing: button input select textarea /* like Blink/WebKit */
    word-spacing: button input select textarea /* like Blink/WebKit */
    line-height: button input select textarea /* like Blink */
    text-transform: button input select textarea /* like Blink/WebKit */
    text-indent: button input select table textarea /* table is currently in the spec */
    text-shadow: button input select textarea /* like Blink/Gecko/WebKit */
    color: ?
    text-align: input select textarea marquee /* like Blink/Gecko/WebKit */
    
  20. zcorpan commented on Aug 13, 2019

    @zcorpan
    Member

    For clarity, the proposal in CSS is

    button, input, select, textarea {
      letter-spacing: initial;
      word-spacing: initial;
      line-height: initial;
      text-transform: initial;
      text-indent: initial;
      text-shadow: initial;
    }
    input, select, textarea, marquee {
      text-align: initial;
    }
    table {
      text-indent: initial;
    }
    

    @MatsPalmgren , do you still disagree with this? Although button isn't a replaced element, it still has various "magic" behaviors, and these properties being reset can be explained by that being what legacy implementations do. (Similarly for table and text-indent.)

  21. MatsPalmgren commented on Aug 22, 2019

    @MatsPalmgren

    Both Gecko and EdgeHTML inherit text-transform by default for <button> which demonstrates that this is web-compatible. That said, I guess I can live with the suggested UA rules in the interest of standardizing something.

  22. added a commit that references this issue on Aug 22, 2019
  23. zcorpan commented on Aug 22, 2019

    @zcorpan
    Member
  24. added a commit that references this issue on Nov 6, 2019
    a17d3bb
  25. added a commit that references this issue on May 18, 2025
    b9997b7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: formstopic: rendering

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions