Unable to add media type from Media UI - form is not submitting

Created on 7 July 2025, 1 day ago

This is happening since upgrading to Drupal 11.2.2
Nothing in browser console log, neither dblog

https://example.ddev.site/admin/structure/media/add

🐛 Bug report
Status

Active

Version

11.2 🔥

Component

media system

Created by

🇵🇰Pakistan isalmanhaider

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @isalmanhaider
  • 🇵🇰Pakistan isalmanhaider

    Interesting — after switching the admin theme from Gin to Claro, the form submission started working as expected.
    This suggests the issue is likely related to Gin, which helps narrow down the scope for further investigation.

  • 🇦🇺Australia pameeela

    I think this is at least major, maybe even critical, because there is no workaround that I can see.

    Clicked around to see whether there were any other forms affected but didn't find any.

  • 🇩🇪Germany jurgenhaas Gottmadingen
  • 🇩🇪Germany jurgenhaas Gottmadingen

    The sticky buttons in that form have the data-drupal-selector="edit-save-continue" attribute, but that should be data-drupal-selector="gin-sticky-edit-save-continue". I'll investigate how that's happening.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    This is an interesting one. Looking into the 4 entity type forms from core

          'node_type_add_form',
          'comment_type_add_form',
          'media_type_add_form',
          'block_content_type_add_form',
    

    they're all built similarly, but only the media type form behaves differently; the other 3 work as expected. This is because this media type create form wants to support browsers with disabled javascript. Therefore, those buttons are changed from type submit into type button. But Gin currently only treats submit type buttons as sticky buttons with the special treatment in the top bar. And that's important that way, as regular buttons usually have a different behavior and don't submit a form.

    The relevant code in core which is responsible for this can be found at \Drupal\media\MediaTypeForm::actions with a comment that explains what's going on.

    I'm uncertain how we should resolve this, TBH. The related Drupal core issue is #3018539: Media types cannot be created in the UI without JavaScript and it's in core since 8.6 in 2018. It probably never occurred to anyone before, as creating new media types through the UI is probably the least that most site builders ever do.

    What are our options?

    • Treating all buttons as sticky submit button? Maybe comes with unexpected side-effects.
    • Adding special treatment in Gin just for this form
    • Revisiting the core approach of handling this
    • other options?
Production build 0.71.5 2024