mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
Do not add autofocus attribute unless set to focus
No Issue - Don't add the "autofocus" attribute to the input element unless the "focus" property is set to true.
This commit is contained in:
parent
d98c6fdad2
commit
8f5120150c
@ -5,16 +5,20 @@ var TrimFocusInput = Ember.TextField.extend({
|
|||||||
attributeBindings: ['autofocus'],
|
attributeBindings: ['autofocus'],
|
||||||
|
|
||||||
autofocus: Ember.computed(function () {
|
autofocus: Ember.computed(function () {
|
||||||
|
if (this.get('focus')) {
|
||||||
return (device.ios()) ? false : 'autofocus';
|
return (device.ios()) ? false : 'autofocus';
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
setFocus: function () {
|
didInsertElement: function () {
|
||||||
// This fix is required until Mobile Safari has reliable
|
// This fix is required until Mobile Safari has reliable
|
||||||
// autofocus, select() or focus() support
|
// autofocus, select() or focus() support
|
||||||
if (this.focus && !device.ios()) {
|
if (this.get('focus') && !device.ios()) {
|
||||||
this.$().val(this.$().val()).focus();
|
this.$().val(this.$().val()).focus();
|
||||||
}
|
}
|
||||||
}.on('didInsertElement'),
|
},
|
||||||
|
|
||||||
focusOut: function () {
|
focusOut: function () {
|
||||||
var text = this.$().val();
|
var text = this.$().val();
|
||||||
|
Loading…
Reference in New Issue
Block a user