forked from extern/egroupware
Focus on the first input field only if the field is empty for mobile theme
This commit is contained in:
parent
afc8e763a2
commit
1108e0b30d
@ -490,15 +490,19 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
|
|||||||
// Automatically set focus to first visible input for popups
|
// Automatically set focus to first visible input for popups
|
||||||
if(this.widgetContainer._egw.is_popup() && $j('[autofocus]',this.DOMContainer).focus().length == 0)
|
if(this.widgetContainer._egw.is_popup() && $j('[autofocus]',this.DOMContainer).focus().length == 0)
|
||||||
{
|
{
|
||||||
$j('input:visible',this.DOMContainer)
|
var $input = $j('input:visible',this.DOMContainer)
|
||||||
// Date fields open the calendar popup on focus
|
// Date fields open the calendar popup on focus
|
||||||
.not('.et2_date')
|
.not('.et2_date')
|
||||||
.filter(function() {
|
.filter(function() {
|
||||||
// Skip inputs that are out of tab ordering
|
// Skip inputs that are out of tab ordering
|
||||||
$this = $j(this);
|
$this = $j(this);
|
||||||
return !$this.attr('tabindex') || $this.attr('tabIndex')>=0;
|
return !$this.attr('tabindex') || $this.attr('tabIndex')>=0;
|
||||||
}).first().focus();
|
}).first();
|
||||||
};
|
|
||||||
|
// mobile device, focus only if the field is empty (usually means new entry)
|
||||||
|
// should focus always for non-mobile one
|
||||||
|
if (egwIsMobile() && $input.val() == "" || !egwIsMobile()) $input.focus();
|
||||||
|
}
|
||||||
|
|
||||||
// Tell others about it
|
// Tell others about it
|
||||||
if(typeof _callback == "function")
|
if(typeof _callback == "function")
|
||||||
|
Loading…
Reference in New Issue
Block a user