3 ms·
It's a big problem. In fact I wish a better layer stack API instead of having a special top-layer for dialog. Problematic UI use cases: - z-index is a hint, t
by diegof79 4y ago
It's a big problem. In fact I wish a better layer stack API instead of having a special top-layer for dialog.
Problematic UI use cases:
- z-index is a hint, the real layering depends on the positioning of the parent element. The usual trick is to insert an element at the bottom of the DOM, and then use z-index.
- If you create a Dropdown or a popup UI (eg. a date picker), the accessibility of focus handling is hard. Your component needs to appear in a top-layer but by inserting it in a div at the bottom, you loose the tab order that goes from the trigger button to the popup. (there is an aria attribute to associate the control, but at least VoiceOver ignores it, and the browser doesn't respect the tab-order).
- The dialog element not only solves the positioning on top, it also solves the focus-trap that is needed for a keyboard navigable (accesible) UI.
- It's possible to use dialog for a non-modal popup. However, the specs doesn't say much about layering. (in fact a quick dialog test in Chrome/Firefox/Safari... they don't follow a predictable layer positioning).
The thing is, if you need to create a dialog, tooltip, dropdown, or popup today... you need a lot of hacks.
- dmitriid 4y ago> The thing is, if you need to create a dialog, tooltip, dropdown, or popup today... you need a lot of hacks. This top layer isn't a solution either. It's still a hack
- diegof79 4y agoI agree. I was answering to the parent comment of: “I'm still trying to grasp the real use of this”. This top-layer feature only solves the element at the bottom + positioning + z-index hack. I wish to have a sort of programmatic stack API. But, the constraint of using HTML makes these things messy. The stack is implicit by nesting dialogs, and dialogs can be modeles, but is not a proper API for pop ups. (the article points to a pop up proposal, but my expectations are low)
- yreg 4y agoYes, this doesn't seem like a proper solution. I can change my modals to top layer, okay. What happens to my dropdowns that can be used both inside the modals and under the modals then?