Firefox and Angular: Textarea placeholder doesn't appear until first focus

早过忘川 提交于 2020-01-05 02:48:09

问题


I have a super-simple Angular app:

<div ng-app>
  <ul>
    <li ng_if='true'>
      <textarea placeholder='Hello'></textarea>
    </li>
  </ul>
</div>

That's it. No JS / CSS.

In FF (34.0 on OSX), the placeholder in the Textarea will not show up until the textarea is focused.

What I've discovered thus far:

  • It's only on textarea. Text inputs are fine.
  • It's only when it's within a child $scope. If the ng-if wasn't there, the issue would disappear.

Play around with it here.

I'm out of ideas. Any help would be super appreciated! :)


回答1:


This is a bug in Gecko, which has been resolved: https://bugzilla.mozilla.org/show_bug.cgi?id=1088158

The fix should be shipped in stable in a few months, but in the meantime, sorry for the inconvenience.




回答2:


This (ugly) work-around seems to work.

<div ng-app>
  <ul>
    <li ng_if='true'>
      <textarea placeholder='Hello'>{{''}}</textarea>
    </li>
  </ul>
</div>


来源:https://stackoverflow.com/questions/27282323/firefox-and-angular-textarea-placeholder-doesnt-appear-until-first-focus

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!