feat(ui5-popup): custom popups work with focusable elements in the sh… #1844
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses two issues:
show
function inPopup.js
setsinline-block
rather thanblock
, which breaks focus behavior in terms of theisNodeHidden
function, when the custom element needs to be analyzed by it. Since popups are always absolutely positioned, and never in the stream of other elements,block
should be as good asinline-block
.getFirstFocusableElement
andgetLastFocusableElement
functions completely skip shadow roots. Therefore focusable elements in the shadow root will be excluded from the focus chain. The fix allows these functions to drill down into shadow roots.Important: when scanning shadow roots, the focus traps should always be skipped, otherwise infinite loops are possible! For this purpose they are marked more explicitly with
data-ui5-focus-trap
.The entirety of these changes will make it possible to have custom popups with predefined buttons (or other focusable elements) and they will now be in the focus chain (and will be focused upon opening the popup, if they are the first focusable element).
closes: #1838