Skip to content

Commit

Permalink
Merge pull request #12332 from craftcms/a11y/remove-autofocus
Browse files Browse the repository at this point in the history
Remove autofocus from element index screens, title fields, and more
  • Loading branch information
brandonkelly authored Jan 10, 2023
2 parents 3034d88 + f4ca0e1 commit a1b2f90
Show file tree
Hide file tree
Showing 15 changed files with 4 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Improved keyboard control of the Updates utility. ([#12189](https://github.com/craftcms/cms/pull/12189))
- Improved the color contrast and keyboard control of the Customize Sources modal. ([#12233](https://github.com/craftcms/cms/pull/12233))
- Improved info icons for screen readers. ([#12272](https://github.com/craftcms/cms/pull/12272))
- Removed input autofocussing throughout the control panel. ([#12324](https://github.com/craftcms/cms/discussions/12324), [#12332](https://github.com/craftcms/cms/pull/12332))

### Administration
- Conditional layout components are now identified using a condition icon within field layout designers. ([#12250](https://github.com/craftcms/cms/issues/12250))
Expand Down
2 changes: 1 addition & 1 deletion src/fieldlayoutelements/TitleField.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class TitleField extends TextField
/**
* @inheritdoc
*/
public bool $autofocus = true;
public bool $autofocus = false;

/**
* @inheritdoc
Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/assets/volumes/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
name: 'name',
value: volume.name,
errors: volume.getErrors('name'),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/categories/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
name: 'name',
value: categoryGroup.name,
errors: categoryGroup.getErrors('name'),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/email/_index.twig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
name: 'fromEmail',
suggestEnvVars: true,
value: settings.fromEmail,
autofocus: true,
required: true,
errors: (freshSettings ? null : settings.getErrors('fromEmail'))
}) }}
Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/fields/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
value: field.name,
errors: field.getErrors('name'),
required: true,
autofocus: true
}) }}

{{ forms.textField({
Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/filesystems/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
name: 'name',
value: (filesystem is defined ? filesystem.name : null),
errors: (filesystem is defined ? filesystem.getErrors('name') : null),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/globals/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
name: 'name',
value: globalSet.name,
errors: globalSet.getErrors('name'),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/sections/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
name: 'name',
value: section.name,
errors: section.getErrors('name'),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/sites/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
value: site.getName(false),
suggestEnvVars: true,
errors: site.getErrors('name'),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/settings/tags/_edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
name: 'name',
value: tagGroup.name,
errors: tagGroup.getErrors('name'),
autofocus: true,
required: true,
}) }}

Expand Down
1 change: 0 additions & 1 deletion src/templates/users/_accountfields.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
id: 'username',
name: 'username',
value: (user is defined ? user.username : null),
autofocus: true,
autocomplete: false,
autocapitalize: false,
disabled: static or (isNewUser or (currentUser.admin or user.getIsCurrent()) ? false : true),
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/web/assets/cp/src/js/BaseElementIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,6 @@ Craft.BaseElementIndex = Garnish.Base.extend(
}
});

// Auto-focus the Search box
if (!Garnish.isMobileBrowser(true)) {
this.$search.trigger('focus');
}

// View menus
this.viewMenus = {};

Expand Down

0 comments on commit a1b2f90

Please sign in to comment.