Skip to content

Blur focused element when hiding the GIS editor modal - #20365

Open
CornElDos wants to merge 1 commit into
phpmyadmin:masterfrom
CornElDos:fix/19793-gis-modal-aria-hidden-focus
Open

Blur focused element when hiding the GIS editor modal#20365
CornElDos wants to merge 1 commit into
phpmyadmin:masterfrom
CornElDos:fix/19793-gis-modal-aria-hidden-focus

Conversation

@CornElDos

Copy link
Copy Markdown

Description

When the GIS editor modal (#gisEditorModal) is dismissed, a focused descendant — typically the close button (.btn-close, which carries data-bs-dismiss="modal") — keeps focus while Bootstrap sets aria-hidden="true" on the modal. Browsers then block the attribute and log:

Blocked aria-hidden on an element because its descendant retained focus. The focus must not be hidden from assistive technology users.

This moves focus out of the modal on the hide.bs.modal event (which fires before the modal becomes aria-hidden) by blurring the focused descendant, so focus returns to the document body and the warning no longer occurs.

The handler is added in the two places that wire up #gisEditorModal (resources/js/table/select.ts and resources/js/table/change.ts), mirroring the existing show.bs.modal handlers there.

Fixes #19793

How to test

  1. Open a table and start inserting or searching a row that has a geometry (spatial) column.
  2. Click the GIS editor button to open the modal, then close it (close button or Esc).
  3. With the browser DevTools console open, confirm the "Blocked aria-hidden on an element…" warning no longer appears.

The commit is signed off per the DCO.

When the GIS editor modal (#gisEditorModal) is dismissed, a focused
descendant such as the close button keeps focus while Bootstrap sets
aria-hidden="true" on the modal. Browsers then block aria-hidden and
warn that the focused element is hidden from assistive technology.

Move focus out of the modal on hide.bs.modal, before it becomes
aria-hidden, by blurring the focused descendant.

Fixes phpmyadmin#19793

Signed-off-by: Cornelii Sandberg <corresandberg@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Blocked aria-hidden on an element because its descendant retained focus

1 participant