mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Merge pull request #4550 from felixrieseberg/iss4446
gh-trim-focus-input autofocus fix for iOS Safari
This commit is contained in:
commit
52a9cddc71
2 changed files with 11 additions and 2 deletions
|
@ -1,8 +1,17 @@
|
||||||
|
/*global device*/
|
||||||
var TrimFocusInput = Ember.TextField.extend({
|
var TrimFocusInput = Ember.TextField.extend({
|
||||||
focus: true,
|
focus: true,
|
||||||
|
|
||||||
|
attributeBindings: ['autofocus'],
|
||||||
|
|
||||||
|
autofocus: Ember.computed(function () {
|
||||||
|
return (device.ios()) ? false : 'autofocus';
|
||||||
|
}),
|
||||||
|
|
||||||
setFocus: function () {
|
setFocus: function () {
|
||||||
if (this.focus) {
|
// This fix is required until Mobile Safari has reliable
|
||||||
|
// autofocus, select() or focus() support
|
||||||
|
if (this.focus && !device.ios()) {
|
||||||
this.$().val(this.$().val()).focus();
|
this.$().val(this.$().val()).focus();
|
||||||
}
|
}
|
||||||
}.on('didInsertElement'),
|
}.on('didInsertElement'),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action 'validateAndAuthenticate' on='submit'}}>
|
<form id="login" class="login-form" method="post" novalidate="novalidate" {{action 'validateAndAuthenticate' on='submit'}}>
|
||||||
<div class="email-wrap">
|
<div class="email-wrap">
|
||||||
<span class="input-icon icon-mail">
|
<span class="input-icon icon-mail">
|
||||||
{{gh-trim-focus-input class="email" type="email" placeholder="Email Address" name="identification" autofocus="autofocus"
|
{{gh-trim-focus-input class="email" type="email" placeholder="Email Address" name="identification"
|
||||||
autocapitalize="off" autocorrect="off" value=identification}}
|
autocapitalize="off" autocorrect="off" value=identification}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue