Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui5-popup): custom popups work with focusable elements in the sh… #1844

Merged
merged 1 commit into from
Jun 22, 2020

Conversation

vladitasev
Copy link
Contributor

This change addresses two issues:

  • The show function in Popup.js sets inline-block rather than block, which breaks focus behavior in terms of the isNodeHidden 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 as inline-block.
  • When looking for focusable elements inside popups, the getFirstFocusableElement and getLastFocusableElement 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

@vladitasev vladitasev merged commit a109558 into master Jun 22, 2020
@vladitasev vladitasev deleted the custom-popups-focusable-elements branch June 22, 2020 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with Popup forwardToLast forwardToFirst
2 participants