Skip to content

[5.x]: Field translatable indicator and action menu triggers are autofocused #16528

@mmikkel

Description

@mmikkel

What happened?

Description

In some cases where autofocus is expected to be set on the first input in a field layout – e.g after creating new nested entries in a Matrix field, or when opening an element in a slideout – Craft will instead autofocus the first field's translatable indicator (triggering its tooltip).

If the first field is not translatable, but has a field actions menu, Craft will put autofocus on the action menu's disclosure trigger instead.

CleanShot.2025-01-25.at.19.39.48.mp4
CleanShot.2025-01-25.at.19.53.13.mp4

(☝ ...note the t9n indicator tooltip rendering behind the slideout in the bottom screencast; creating another issue for that 🙂)

Steps to reproduce

  1. Create a Matrix field. Use the inline-editable mode. Add an entry type where the first field is a translatable Plain Text field.
  2. Add the Matrix field to an entry type's field layout.
  3. Create a new nested entry in the field, and observe that Craft will auto-focus the new nested entry's first field's translatable indicator; triggering its tooltip.

OR

  1. Create an entry where the first field in the layout is translatable
  2. Open that entry in a slideout
  3. Observe that the autofocus is set to the first field's t9n indicator

Expected behavior

When creating new nested entries or opening elements in slideouts, autofocus should be set on the first field input, not on translatable indicators or field action menu triggers.

Actual behavior

If the first field in a field layout is translatable or has a field actions menu, Craft will autofocus the t9n indicator or action menu trigger instead of the field's input.

Craft CMS version

5.6.1

PHP version

No response

Operating system and version

macOS 14.6.1, MS Edge 131.0.2903.112

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

None

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions