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:
- Install Drupal 8.8.0
- Enable Media and Media library modules
- Create a media field on a node type that uses the media library widget
- Create a node using the media library widget
- Edit the node
- 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
Comment #2
pameeela commentedComment #3
pameeela commentedComment #4
seanbThis 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!
Comment #5
pameeela commentedAhh thank you! I looked for something but couldn't find it. So glad there is a patch!