Skip to content

fix(Modal): Autofocus close button, if it is the only focusable element

Lukas Eipert requested to merge leipert-fix-modal-autofocus into master

What does this MR do?

If there is a modal that has no focusable element in the modal content AND no modal footer, it should focus the close button.

The close button is the last focusable element we try to focus, and it doesn't work correctly because it is moved to the end of the list with the help of Array.splice which doesn't return the Element, but an array of elements.

Does this MR meet the acceptance criteria?

Conformity

  • Code review guidelines.
  • GitLab UI's contributing guidlines.
  • If it changes a Pajamas-compliant component's look & feel, the MR has been reviewed by a UX designer.
  • If it changes GitLab UI's documentation guidelines, the MR has been reviewed by a Technical Writer.
  • If the MR changes a component's API, integration MR(s) have been opened in the following projects to ensure that the @gitlab/ui package can be upgraded quickly after the changes are released:
  • Added the ~"component:*" label(s) if applicable.

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Lukas Eipert

Merge request reports