Part of the Mercury ecosystem · 14 projects
Mercury Editor lets editors build pages visually, but the entity form in its sidebar can be long and split across tabs. Mercury Editor Field Focus connects the two. Click a field in the live preview, such
as the title, a hero image or a summary, and the sidebar opens, switches to the tab that holds that field and puts the cursor in it.
It needs no configuration. Enable it and the fields of the page being edited become clickable in the preview.
Features
- Click to edit: clicking a field in the preview focuses the matching field in the sidebar form. Mercury Editor opens the sidebar if it is closed.
- Finds hidden fields: it shows the vertical or horizontal tab, or expands the collapsed details group, that contains the field, including nested ones.
- Works with rich text: it waits for CKEditor 5 to finish loading, then focuses the editor and scrolls it into view.
- Keyboard accessible: triggers that are not already links or buttons get
tabindex="0"androle="button". Enter and Space activate them. - Three ways to trigger focus:
- A click or keypress on any element marked
data-me-focus-field="field_name"in the preview. - The
?me_focus=field_namequery parameter on the Mercury Editor URL. The parameter is removed after use, so reloading does not move focus again. - JavaScript:
Drupal.mercuryEditorFieldFocus.focusField('field_name')orDrupal.mercuryEditorBus.post('editor:focusField', { field: 'field_name' }).
- A click or keypress on any element marked
Use it on content types with many fields, or sidebar forms organized into tabs, where editors would otherwise scroll and hunt for the field behind what they see on the page. It also suits custom editing UIs
that need to send editors to a specific field.
Post-Installation
There is no configuration page, permission or settings form. Install and enable the module, then open an entity in Mercury Editor.
- Fields rendered through the standard field wrapper get a
data-me-focus-fieldattribute automatically, but only on the entity being edited and only inside the Mercury Editor
preview. Visitors never see the attribute. Your theme's field templates must print the field's attributes, which Drupal core and most themes do. - Values printed outside a field wrapper, such as a node title, need a small template change. On the edited node the module sets a
me_focus_fieldsvariable in
node.html.twig:<h1{% if me_focus_fields %} data-me-focus-field="title"{% endif %}>{{ label }}</h1> - You can add
data-me-focus-field="field_name"to any element in the preview markup, for example in a custom block or component, to make it a trigger.
The field name is the machine name, for example field_summary. If it doesn't match a field in the sidebar form, nothing happens.
Additional Requirements
- Drupal 11
- Mercury Editor
It also uses the jQuery, once and Drupal behaviors libraries that ship with core, so there is nothing else to install.
Recommended modules/libraries
- Mercury Editor (required), which provides the editor, preview and sidebar form.
- Layout Paragraphs, which Mercury Editor builds on and is commonly used with it.
Ask your assistant about Mercury Editor Field Focus
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Mercury ecosystem
Most installed first
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.0.0-alpha1 | Pre-release | 11 | Dec 1, 2026 |