Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
#1843220: Convert form AJAX to new AJAX API broke the automagical #ajax['dialog'] stuff because the page title used to be passed to the front end in a hackish sort-of-way in the old ajax_prepare_response(), and we accidentally dropped it in the new D8 ajax forms.
A temporary measure has been posted to the initial #1843220: Convert form AJAX to new AJAX API issue to fix HEAD for the moment, but I think a better solution is in order. As does the author of the relevant javascript:
// If the requesting object wanted the response in a dialog, open that
// dialog. However, a single server response can include multiple insert
// commands (e.g., one for the primary content and another one for status
// messages), but we only want to open the dialog once, so we assume that
// only commands with a title property are dialog eligible.
// @todo Consider whether this is overloading title inappropriately, and
// if so, find another way to determine dialog eligibility.
if (ajax.dialog && ('title' in response)) {
var dialogOptions = $.extend({title: response.title}, ajax.dialog);
var dialog = Drupal.dialog(wrapper, dialogOptions);
ajax.dialog.modal ? dialog.showModal() : dialog.show();
}
Comment | File | Size | Author |
---|---|---|---|
#19 | issue.png | 57.83 KB | fallenturtle |
Comments
Comment #1
Crell CreditAttribution: Crell commentedRelated: #1871596: Create a PartialResponse class to encapsulate html-level data [Moving to sandbox]
If that goes in, then controllers can return a strutured object with body and title and eventually other things like new HTML link tags. The AjaxController should be able to dissect that and turn it into the appropriate set of InsertCommand objects, or whatever else we want.
Comment #2
catchYep what Crell said, drupal_set/get_title() need to go.
See also #1839338: [meta] Remove drupal_set_*() drupal_add_*() in favour of #attached/response for out-of-band stuff.
Comment #3
jibranTagging.
Comment #4
jessebeach CreditAttribution: jessebeach commentedRemoved a spurious "the" from the issue title.
Comment #5
dawehner#2100073-11: Convert local_actions to the new local action plugins has some code to use the title resolver introduced in some issue.
Comment #6
mgiffordComment #19
fallenturtle CreditAttribution: fallenturtle commentedI'm trying to troubleshoot why the modal that is created via the combo of Entity Browser/Inline Entity Form isn't being announced by the NVDA screenreader and I'm wonder if its related to this issue and if there is anything that can be done in time being. My understanding, I think, is that it relies on a combination of a container with the role of dialog and also having an aria labeled by that references another element's ID, that other element having the text that the screen reader is supposed to read.... I see both in the markup, but its not being announced.
Nevermind, seems to be something with my theme, works fine when I switched to a core supplied theme.