Skip to content

Placeholder text for text areas indent #2307

Closed

Description

@kimsaabyepedersen

Hi
I have created an app with ionic b13 that uses a text area with a placeholder text.

When the text area gets focus, the cursor and placeholder are not aligned correctly.

See photo

error

Activity

  1. kimsaabyepedersen commented on Sep 27, 2014

    @kimsaabyepedersen
    Author

    I have also found that setting text-align to 5px (the padding size) fixes the problem (the ion-content has padding="true"):

    //ionic.css line 5167
    input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
    color: #aaaaaa;
    text-indent: 0;
    }

    change text-indent to 5x px if padding.

    Btw, further up (line 5137) that style sheet this rule defined:
    textarea::-webkit-input-placeholder {
    color: #aaaaaa;
    text-indent: -3px;
    }

    But that gets overridden by the one further down in the stylesheet.

  2. kimsaabyepedersen commented on Sep 27, 2014

    @kimsaabyepedersen
    Author

    Maybe I did not state it clearly but the problem occurs in iOS (version 7.1 - I have only tested that), iPhone (I have only tested that).

  3. GringoDotDev commented on Dec 28, 2014

    @GringoDotDev

    This still occurs for me on beta 14.

  4. self-assigned this
    on Apr 17, 2015
  5. added this to the milestone on Apr 17, 2015
  6. mhartington commented on Apr 17, 2015

    @mhartington
    Contributor

    Looking into this.

  7. modified the milestones: 1.0.1, 1.0.0-rc6 on May 5, 2015
  8. WinfredMa commented on Jun 15, 2015

    @WinfredMa

    /* ----------- iPhone 4 and 4S ----------- */
    @media only screen
    and (device-width: 320px)
    and (device-height: 480px)
    and (-webkit-min-device-pixel-ratio: 2) {
    textarea {
    text-indent: -3px;
    }
    }

    /* ----------- iPhone 5 and 5S ----------- */
    @media only screen
    and (device-width: 320px)
    and (device-height: 568px)
    and (-webkit-min-device-pixel-ratio: 2) {
    textarea {
    text-indent: -3px;
    }
    }

    /* ----------- iPhone 6 ----------- */
    @media only screen
    and (device-width: 375px)
    and (device-height: 667px)
    and (-webkit-min-device-pixel-ratio: 2) {
    textarea {
    text-indent: -3px;
    }
    }

    /* ----------- iPhone 6+ ----------- */
    @media only screen
    and (device-width: 414px)
    and (device-height: 736px)
    and (-webkit-min-device-pixel-ratio: 3) {
    textarea {
    text-indent: -3px;
    }
    }

  9. modified the milestones: 1.0.1, 1.2 on Aug 15, 2015
  10. 10 remaining items

  11. reopened this on Dec 17, 2015
  12. modified the milestones: 1.3, 1.2.1 on Dec 17, 2015
  13. JCsplash commented on Jan 25, 2016

    @JCsplash

    Hey everyone I think I found a solution without using text-indent (which only seems to work for the first line). Hope this helps!

    textarea::placeholder {
    padding-left:3px
    }

    textarea{
    margin-left:-3px
    }

  14. taigeair commented on Apr 15, 2016

    @taigeair

    @JCsplash thanks for that tip. Your placeholder wasn't working for Safari Mobile so I added some webkit lines to it. I got it working with this code below:

    /* iPhone fix */ 
    
    .platform-ios textarea, 
    .platform-ipad textarea  {
    }
    
    
    .platform-ios textarea::-webkit-input-placeholder,
    .platform-ipad textarea::-webkit-input-placeholder {
    padding-left:3px !important; 
    }
    
    .platform-ios textarea:-moz-placeholder,
    .platform-ipad textarea:-moz-placeholder { /* Firefox 18- */
    padding-left:3px !important; 
    }
    
    .platform-ios textarea::-moz-placeholder,
    .platform-ipad textarea:-moz-placeholder {  /* Firefox 19+ */
    padding-left:3px !important; 
    }
    
    .platform-ios textarea:-ms-input-placeholder,
    .platform-ipad textarea:-moz-placeholder {  
    padding-left:3px !important; 
    }
    
    .platform-ios textarea,
    .platform-ipad textarea {
    margin-left:-3px !important; 
    }
    
  15. jgw96 commented on Apr 29, 2016

    @jgw96
    Contributor

    Hello all! Is this still an issue with the latest version of ionic? Thanks!

  16. added
    needs: reply
    on Apr 29, 2016
  17. jgw96 commented on May 4, 2016

    @jgw96
    Contributor

    Hello all! As it seems it has been a while since there was any activity on this issue i will be closing it for now. Feel free to comment if you are still running into this issue. Thanks for using Ionic!

  18. jaroslavrehorka commented on Nov 8, 2016

    @jaroslavrehorka

    This issue is still present in RC2, negative text-indent helped me
    screen shot 2016-11-08 at 10 59 21

  19. bettysteger commented on May 5, 2017

    @bettysteger

    this worked for me:

    .platform-ios {
        textarea {
            margin-left: -3px;
            &::placeholder {
                padding-left: 3px;
            }
        }
    }
    
  20. doushan commented on Jul 4, 2018

    @doushan
  21. ionitron-bot commented on Sep 1, 2018

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  22. locked and limited conversation to collaborators on Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs: reply

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions