Closed tleunen closed 8 years ago
When it's in the open state you could use the following attributes to achieve this (on top of the base polyfill styles)
dialog[open] {
position: fixed;
top: 50%;
transform: translateY(-50%);
}
The native dialog isn't actually fixed - it's centered in the current viewport when the dialog is first shown.
Having said that, applying position: fixed
to the native dialog in Chrome causes it to always remain centered regardless of scrolling (although it's vertical center is calculated on show, not e.g. if the window is resized or device rotated).
The polyfill should therefore support automatic vertical positioning of position: fixed
dialogs.
@jaasum I've basically added this CSS to the end of the top-level README.md
as a hint.
The native dialog seems to be in a fixed position, always centered horizontally and vertically... It would be a lot easier if it was the case for the polyfill as well.