Problem/Motivation

All entity edit forms have meta data fields in the right sidebar. If the form contains an ajax handler, as soon as that gets used, the form rebuilds, and from then on the sidebar disappears and its content shows at the bottom of the form itself.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#3 recording-2026-09-16_16.17.09.mp4337.74 KBjurgenhaas

Comments

jurgenhaas created an issue. See original summary.

rupeshghar’s picture

Could you please add steps to reproduce this issue?

jurgenhaas’s picture

StatusFileSize
new337.74 KB

I've attached a recording showing the effect. When using a simple text field with unlimited cardinality, adding more items uses AJAX, and that works well, without an issue. When using an AJAX handler on a button that re-builds the form, it fails. An example for that is an ECA model that provides such functionality, e.g. https://ecaguide.org/library/forms/form_button_with_an_ajax_handler/. Applying that on Drupal 12 currently fails because it requires text_with_summary and the article_content_type recipe, both of which have been removed from main.

The technical reason for this behavior comes from the hook_form_alter helper function stickyActionButtonsAndSidebar in Drupal\default_admin\Hook\FormHooks. This builds the sidebar, but it doesn't if $this->isAjax() is true.

Why this breaks for the ECA AJAX handler and not for the field widget? It's because the former does a full form rebuild and returns the entire fresh form, while the latter only returns the targeted field widget. We could fix this by not ignoring the form alter for all AJAX calls, but just for drupal_modal and drupal_dialog. But I'm certain that will cause other unintended side-effects.

So, as this is not an issue in Drupal core alone, only in context of a contrib module that introduces an AJAX handler for a full form refresh, this should probably be lowered in severity, removed from the stable blocker in #3576488: [meta] Admin theme: path to beta, stable, and beyond, and then addressed with full research at some later point.

jurgenhaas’s picture

Title: Sidebar in entity edit forms moves to form botton if an ajax handler refreshes the form » Sidebar in entity edit forms moves to form bottom if an ajax handler refreshes the form

Clarification following a Slack conversation: removing the isAjax() handling in default_admin entirely would break lots of other things, media browser in particular, which gets loaded by AJAX into a dialog. So, that's not an option in my view.