Focus any element on ajax calls

Created on 12 September 2019, over 5 years ago
Updated 28 April 2023, over 1 year ago

Problem/Motivation

Targeting the parent of the removed DOM element on ajax sets focus, which is implicitly applicable to a limited set of elements, such as form elements (input, select, etc.) and links (a), based on https://api.jquery.com/focus.

Noticed that while working on the Entity browser issue linked here.

Steps to reproduce

  • Use an entity browser and edit an image.
  • After clicking "Save" in the modal, the "Save" button on the node gets focused - fixable by setting 'disable-refocus' => TRUE on the submit button in the Entity browser
  • With that fix above, no focus is set at all

Proposed resolution

We can use all element types by using tabindex.

🐛 Bug report
Status

Closed: duplicate

Version

10.1

Component
Ajax 

Last updated about 1 hour ago

Created by

🇸🇮Slovenia sasanikolic

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

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.

Production build 0.71.5 2024