Figure out a better way to get the page title to a modal dialog

Created on 11 March 2013, over 11 years ago
Updated 11 October 2023, 9 months ago

#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();
    }
πŸ“Œ Task
Status

Active

Version

9.5

Component
AjaxΒ  β†’

Last updated 13 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States mkadin

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States fallenturtle

    I'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.

Production build 0.69.0 2024