Skip to content

Commit ec46d15

Browse files
committed
BUG - center search modal on wide screens
1 parent 4274105 commit ec46d15

File tree

1 file changed

+18
-31
lines changed
  • src/pydata_sphinx_theme/assets/styles/components

1 file changed

+18
-31
lines changed

src/pydata_sphinx_theme/assets/styles/components/_search.scss

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -82,39 +82,26 @@
8282
/**
8383
* The search modal <dialog>
8484
*/
85-
#pst-search-dialog {
86-
display: none;
87-
88-
&[open] {
89-
display: flex;
90-
91-
// Center in middle of screen just underneath header
92-
position: fixed;
93-
z-index: $zindex-modal;
94-
top: 30%;
95-
left: 50%;
96-
transform: translate(-50%, -50%);
97-
right: 1rem;
98-
margin-top: 0.5rem;
99-
width: 90%;
100-
max-width: 800px;
101-
background-color: transparent;
102-
padding: $focus-ring-width;
103-
border: none;
104-
105-
&::backdrop {
106-
background-color: black;
107-
opacity: 0.5;
108-
}
85+
#pst-search-dialog[open] {
86+
margin: 25vh auto 0; // an open modal dialog has a fixed position, so these margins bring it 25% down the viewport height and center it horizontally
87+
width: 90%;
88+
max-width: 800px;
89+
background-color: transparent;
90+
padding: $focus-ring-width;
91+
border: none;
92+
93+
&::backdrop {
94+
background-color: black;
95+
opacity: 0.5;
96+
}
10997

110-
form.bd-search {
111-
flex-grow: 1;
98+
form.bd-search {
99+
flex-grow: 1;
112100

113-
// Font and input text a bit bigger
114-
svg,
115-
input {
116-
font-size: var(--pst-font-size-icon);
117-
}
101+
// Font and input text a bit bigger
102+
svg,
103+
input {
104+
font-size: var(--pst-font-size-icon);
118105
}
119106
}
120107
}

0 commit comments

Comments
 (0)