Skip to content
Snippets Groups Projects

Resolve #3397785 "Dialog focus is"

Closed Lauri Timmanee requested to merge issue/drupal-3397785:3397785-dialog-focus-is into 11.x

Closes #3397785

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
42 42 // In these instances, force focus on the dialog.
43 43 if (document.activeElement === document.body) {
44 44 $dialog.dialog('widget').trigger('focus');
  • Srishti Bankar added 1 commit

    added 1 commit

    Compare with previous version

  • Srishti Bankar added 1 commit

    added 1 commit

    • 8f41b430 - Fix EntityReferenceWidgetTest

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    • d8e6fea5 - reverted media_library changes

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • 41 41 // If the body element has focus, it means focus was effectively lost.
    42 42 // In these instances, force focus on the dialog.
    43 43 if (document.activeElement === document.body) {
    44 $dialog.dialog('widget').trigger('focus');
    44 // Bypass media as it has its own focus handling.
    45 if (
    46 document.getElementsByClassName('media-library-widget-modal').length
  • Yash Rode added 24 commits

    added 24 commits

    Compare with previous version

  • Yash Rode added 13 commits

    added 13 commits

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • Yash Rode added 1 commit

    added 1 commit

    Compare with previous version

  • 39 39 }
    40 40
    41 // If the body element has focus, it means focus was effectively lost.
    42 // In these instances, force focus on the dialog.
    43 if (document.activeElement === document.body) {
    44 $dialog.dialog('widget').trigger('focus');
    45 }
    41 // If the focus is outside of active element move it to the first focusable element.
    42 setTimeout(function () {
    43 const dialogInstance = $dialog.dialog('instance');
    44
    45 // Check if the dialog has focus
    46 if (dialogInstance && dialogInstance._focusedElement) {
    47 const focusedElement = dialogInstance._focusedElement;
    48 // Check if the focused element is inside the document.body
    49 const isInsideBody = document.body.contains(focusedElement[0]);
  • Yash Rode added 21 commits

    added 21 commits

    Compare with previous version

  • 41 // If the body element has focus, it means focus was effectively lost.
    42 // In these instances, force focus on the dialog.
    43 if (document.activeElement === document.body) {
    44 $dialog.dialog('widget').trigger('focus');
    45 }
    41 // If the focus is outside of active element move it to the first focusable element.
    42 setTimeout(function () {
    43 const dialogInstance = $dialog.dialog('instance');
    44
    45 // Check if the dialog has focus.
    46 if (dialogInstance && dialogInstance._focusedElement) {
    47 const focusedElement = dialogInstance._focusedElement;
    48 // Check if the focused element is inside the dialog.
    49 const isInsideDialog = $dialog[0].contains(focusedElement[0]);
    50
    51 if (!isInsideDialog || document.activeElement === document.body) {
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading