Problem/Motivation

When using the 'Media library' widget on a media entity reference field, the node edit form sets focus to the media field if there is a value.

It's especially pronounced / annoying if the media field is lower on the form; you have to scroll to the top each time. I assume this also has accessibility implications for keyboard navigation.

Steps to reproduce:

  1. Install Drupal 8.8.0
  2. Enable Media and Media library modules
  3. Create a media field on a node type that uses the media library widget
  4. Create a node using the media library widget
  5. Edit the node
  6. See the form focus goes to the media library field

This does not occur if you use the Autocomplete widget, or if the field has no value.

Screenshot of the node edit form on load, with media using media library widget:

Screenshot of the same, with no value in the field:

Proposed resolution

Ensure the node edit form loads from the top, as normal, even if there is a media library field with a value.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

pameeela created an issue. See original summary.

pameeela’s picture

Issue tags: +media library
pameeela’s picture

Issue summary: View changes
StatusFileSize
new38.82 KB
seanb’s picture

Status: Active » Closed (duplicate)

This seems to be a duplicate of #3089745: Add focus behaviour for media widget with max elements, which has a patch. Let's continue there. Thanks for reporting the issue!

pameeela’s picture

Ahh thank you! I looked for something but couldn't find it. So glad there is a patch!