﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
8194	Admin form keyboard focus does not respect fields or fieldsets options	mdhancher	nobody	"When you re-order the fields in an admin add form using the `fields` or `fieldsets` options in your `ModelAdmin` class, the initial keyboard focus in the admin add/change form does not respect it.

The keyboard focus is set by a !JavaScript call to `document.getElementById(""id_foo"").focus()`, where the ID is specified in the `change_form.html` template as `{{adminform.first_field.auto_id}}`.  So an underlying issue is that `AdminForm.first_field()` (in `contrib/admin/options.py`) does not respect the re-ordering.  I am experiencing this using the current Subversion HEAD, revision 8272.

For example, consider this simple model in `models.py`:
{{{
class MyModel(models.Model):
    foo = models.CharField(max_length=255)
    bar = models.CharField(max_length=255)
}}}
and this simple admin configuration in `admin.py`:
{{{
class MyModelAdmin(admin.ModelAdmin):
    fields = ('bar', 'foo')

admin.site.register(MyModel,MyModelAdmin)
}}}
Then try to add a new !MyModel object using the admin interface, and notice that they keyboard focus starts out at the bottom rather than the top of the form."		closed	contrib.admin	dev		fixed	newforms-admin	ciantic@…	Accepted	1	0	0	1	0	0
