-
Notifications
You must be signed in to change notification settings - Fork 14
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
Z-index guidelines #4407
Comments
We will not create any tokens for this. |
Resolution: Create demo page to identify problematic use cases where two elements try to be on the top layer (open dialog with toast message) and try to figure out how we can control which takes precedence. Also, confirm with an example if e.g. dropdowns or tooltips work in an open dialog in the top layer. |
Here is a codepen testing multiple popovers on the same page: https://codepen.io/leamcg/pen/yyBxxKE The behaviour with popover elements is that the most recent one to appear on the screen will always be placed on top of others within the A popover inside another (e.g., a dialog within a dialog, or a tooltip inside a dialog) should not cause any issues. The child popover is not restricted by the parent. However, there is a potential concern with toasts and alerts, as they may end up appearing beneath a dialog backdrop, making them less visible. If the toast or alert is a popover, its visibility depends on when it appears relative to the dialog: if the toast appears before the dialog opens, it will be positioned behind it; if it appears after, it will be on top and clearly visible. A solution could be to listen to popovers appearing on the page and simply rerendering toasts when they do to make sure they are always on top. Though the native behavour might actually make sense - if a toast is visible and a user interacts with the UI to open a dialog, it's reasonable to assume the toast is less important and can be obscured. |
Proposed resolution: use top layer the standard way for components that can benefit from it (e.g. not the header megadropdown). |
z-index variables:
In the styles\src\variables_commons.scss file we have:
$zindex-spinner: 990 !default;
$zindex-dropdown: 1000 !default; (top layer)
$zindex-sticky: 1020 !default;
$zindex-fixed: 1030 !default;
$zindex-modal-backdrop: 1040 !default; (top layer backdrop)
$zindex-modal: 1055 !default; (top layer)
$zindex-popover: 1060 !default; (top layer)
$zindex-tooltip: 1070 !default; (top layer)
$zindex-alert: 1080 !default; (top layer)
$zindex-header: 1090 !default;
...
Header z-index has been set so far with the custom property --header-z-index, usually with a default value of 10 (same value as post.ch header's z-index).
Tasks
The text was updated successfully, but these errors were encountered: