Skip to content

Apply autofocus to form fields in ajax loaded pages

Helmo requested to merge helmo/ispconfig3:patch-autofocus into develop

On the login form ISPconfig had an autofocus attribute on the username field.

That is a standard and handled by the browser, but such a feature would also be useful for our forms. In most cases there is a clear 'first' field, but no field gets focus when a form is loaded via JS.

I opt to add a call in onAfterContentLoad() that mimics this behaviour. Then we can add add the autofocus attribute in each form to the field that makes most sense.

As an example I've set in now in the forms: DNS a record, user_mailbox, mail_aliasdomain

If you agree then we can add a few more autofocus attributes before merging.

The relevant html spec: https://html.spec.whatwg.org/multipage/interaction.html#the-autofocus-attribute

Edited by Helmo

Merge request reports