Open jamesjacobs opened 4 years ago
There are also non-Pulsar 'lightboxes' still in use in various older areas of the UI, this is a prime opportunity to unify the modal solution across products.
From @james-manley
Calling trapFocus makes sense, but in reality that just adds more keydown handlers. We need to remove the old invalid ones as part of trapFocus().
Currently, modals that load content with AJAX require
trapFocus()
to be called on AJAX completion. This has been raised as an issue by product teams as has the list of allowed elements within thetrapFocus
method.This has highlighted the wide variety of modals we have across products, such as:
Recommended action:
ModalFocusService
to check that element trying to gain focus is within the modal, rather than passing it a jQuery collection of the modal (to avoid having to calltrapFocus
on AJAX completion).ModalFocusService
should control which elements can be focussed.Related info: https://www.w3.org/TR/2017/NOTE-wai-aria-practices-1.1-20171214/examples/dialog-modal/js/dialog.js