No Focus on Second Open Dialog

Created on 20 February 2024, 9 months ago
Updated 3 July 2024, 5 months ago

Problem/Motivation

When a second dialog window opens (two open at the same time), focus remains on first modal, not the new open modal.

Steps to reproduce

These steps include using Paragraphs and Layout Paragraphs modules; but, the underlying issue appears to be related to a JS file in core (see Proposed Resolution below). It could occur anytime there are multiple dialogs open; these steps are just ones that are related to my use case where I stumbled on the bug.

  1. Clean Drupal 10.2.x-dev build
  2. Enable the media and media_library modules
  3. Download and enable the paragraphs and layout_paragraphs modules
  4. Create a new paragraph type 'My Paragraph' and add a media reference field to it (Entity Reference: Media)
  5. Add a new Entity Reference (Paragraphs) field to the Basic Page content type and link it to "My Paragraph." Make the field use the 'layout paragraphs' widget in the form display.
  6. Go to /node/add/page and scroll to the paragraph reference field. Click the 'plus' icon.
  7. Click the 'Add Media' button. Focus will still be on the 'Create new My Paragraph' modal, not the Media Library's 'Add or Select Media' picker. Hit the 'tab' key multiple times to demonstrate (not your mouse)

Proposed resolution

This may be related to a recent fix to core/misc/dialog/dialog.ajax.js core discussed here: https://www.drupal.org/project/drupal/issues/3397785 ๐Ÿ› Dialog focus is returned to dialog instead of first tabbable element on dialog AJAX update Fixed .

If so, adding something like this to line 42 of dialog.ajax.js may address the issue:

if ($('.ui-dialog-content').length > 1) { $dialog = $('.ui-dialog-content:last'); }

(This snippet would also require changing the $dialog declaration to make it a variable instead of a constant.

๐Ÿ› Bug report
Status

Active

Version

11.0 ๐Ÿ”ฅ

Component
Javascriptย  โ†’

Last updated 3 days ago

  • Maintained by
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom @justafish
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance @nod_
Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States cscottjames

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024