Skip to content

Commit de61cf5

Browse files
authored
Merge pull request #1714 from hrx01-dev/fix/mobile-top-gap-skip-link
fix mobile view top gap
2 parents 09cb2e2 + 1663682 commit de61cf5

1 file changed

Lines changed: 220 additions & 1 deletion

File tree

src/css/custom.css

Lines changed: 220 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,86 @@
55
color: inherit;
66
}
77

8+
/* FINAL MOBILE OVERRIDE: aggressively remove any top gap on narrow viewports
9+
This targets any leftover placeholders, pseudo-elements, safe-area padding,
10+
or theme-provided offsets. Keep it last so it wins over other rules. */
11+
@media screen and (max-width: 1024px) {
12+
13+
/* remove any generated placeholders or spacer elements that push content down */
14+
.theme-doc-navbar-placeholder,
15+
.theme-doc-navbar-placeholder * {
16+
display: none !important;
17+
height: 0 !important;
18+
margin: 0 !important;
19+
padding: 0 !important;
20+
overflow: hidden !important;
21+
}
22+
23+
/* global resets for top spacing and pseudo-elements */
24+
html,
25+
body,
26+
#__docusaurus,
27+
.main-wrapper,
28+
header,
29+
.theme-doc-navbar,
30+
.navbar {
31+
margin: 0 !important;
32+
padding: 0 !important;
33+
top: 0 !important;
34+
min-height: 0 !important;
35+
background-clip: border-box !important;
36+
}
37+
38+
/* remove any pseudo elements that could create a visible gap */
39+
html::before,
40+
html::after,
41+
body::before,
42+
body::after,
43+
header::before,
44+
header::after,
45+
.navbar::before,
46+
.navbar::after,
47+
.theme-doc-navbar::before,
48+
.theme-doc-navbar::after {
49+
content: none !important;
50+
display: none !important;
51+
height: 0 !important;
52+
margin: 0 !important;
53+
padding: 0 !important;
54+
}
55+
56+
/* pin header to the very top and extend background into the safe area */
57+
header,
58+
.theme-doc-navbar,
59+
.navbar {
60+
position: fixed !important;
61+
left: 0 !important;
62+
right: 0 !important;
63+
top: 0 !important;
64+
z-index: 99999 !important;
65+
padding-top: env(safe-area-inset-top, 0px) !important;
66+
background: var(--ifm-navbar-background-color, var(--ifm-background-color, #0b1220)) !important;
67+
box-shadow: none !important;
68+
}
69+
70+
/* ensure inner navbar doesn't add height */
71+
.navbar__inner,
72+
.navbar__brand {
73+
margin: 0 !important;
74+
padding: 0.5rem 0.75rem !important;
75+
height: auto !important;
76+
}
77+
78+
/* move the page content up directly under the fixed header */
79+
main,
80+
#__docusaurus,
81+
.main-wrapper {
82+
margin: 0 !important;
83+
padding-top: calc(var(--ifm-navbar-height, 56px) + env(safe-area-inset-top, 0px)) !important;
84+
}
85+
86+
}
87+
888
/* Careers testimonials */
989
.testimonials-section .testimonial-carousel {
1090
background: #ffffff;
@@ -1040,10 +1120,49 @@ html {
10401120

10411121
/* Enhanced focus styles */
10421122
*:focus {
1123+
10431124
outline: 2px solid #667eea;
10441125
outline-offset: 2px;
10451126
}
10461127

1128+
/* Mobile: keep the accessibility skip-link out of the visible top band.
1129+
It stays keyboard-accessible because it becomes visible again on focus. */
1130+
@media screen and (max-width: 996px) {
1131+
1132+
.skipToContent_fXgn,
1133+
div[role="region"][aria-label="Skip to main content"] {
1134+
position: fixed !important;
1135+
left: 0 !important;
1136+
top: 0 !important;
1137+
width: 1px !important;
1138+
height: 1px !important;
1139+
margin: 0 !important;
1140+
padding: 0 !important;
1141+
overflow: hidden !important;
1142+
clip: rect(0, 0, 0, 0) !important;
1143+
clip-path: inset(50%) !important;
1144+
white-space: nowrap !important;
1145+
border: 0 !important;
1146+
}
1147+
1148+
.skipToContent_fXgn:focus,
1149+
.skipToContent_fXgn:focus-visible,
1150+
div[role="region"][aria-label="Skip to main content"]:focus,
1151+
div[role="region"][aria-label="Skip to main content"]:focus-within {
1152+
position: fixed !important;
1153+
left: 1rem !important;
1154+
top: 1rem !important;
1155+
width: auto !important;
1156+
height: auto !important;
1157+
margin: 0 !important;
1158+
padding: 0.5rem 1rem !important;
1159+
overflow: visible !important;
1160+
clip: auto !important;
1161+
clip-path: none !important;
1162+
white-space: normal !important;
1163+
}
1164+
}
1165+
10471166
/* Custom selection colors */
10481167
::selection {
10491168
background: rgba(102, 126, 234, 0.2);
@@ -2347,4 +2466,104 @@ html[data-theme="dark"] .blog-post-page .markdown h4 {
23472466

23482467
/* =====================================================
23492468
END SECTION 15
2350-
===================================================== */
2469+
===================================================== */
2470+
2471+
/* ===== MOBILE TOP-GAP FIX ===== */
2472+
@media screen and (max-width: 996px) {
2473+
2474+
html,
2475+
body,
2476+
#__docusaurus,
2477+
.main-wrapper,
2478+
header,
2479+
.theme-doc-navbar,
2480+
.navbar,
2481+
.navbar--fixed-top,
2482+
.theme-doc-navbar-placeholder {
2483+
margin: 0 !important;
2484+
padding: 0 !important;
2485+
top: 0 !important;
2486+
}
2487+
2488+
html,
2489+
body {
2490+
min-height: 100% !important;
2491+
background: var(--ifm-navbar-background-color, var(--ifm-background-color)) !important;
2492+
}
2493+
2494+
body {
2495+
overflow-x: hidden !important;
2496+
}
2497+
2498+
.theme-doc-navbar-placeholder,
2499+
.theme-doc-navbar-placeholder * {
2500+
display: none !important;
2501+
visibility: hidden !important;
2502+
height: 0 !important;
2503+
min-height: 0 !important;
2504+
max-height: 0 !important;
2505+
margin: 0 !important;
2506+
padding: 0 !important;
2507+
overflow: hidden !important;
2508+
}
2509+
2510+
header,
2511+
.theme-doc-navbar,
2512+
.navbar,
2513+
.navbar--fixed-top {
2514+
position: sticky !important;
2515+
inset: auto !important;
2516+
z-index: 99999 !important;
2517+
box-shadow: none !important;
2518+
transform: none !important;
2519+
min-height: 0 !important;
2520+
background: var(--ifm-navbar-background-color, var(--ifm-background-color)) !important;
2521+
background-clip: padding-box !important;
2522+
}
2523+
2524+
.navbar__inner,
2525+
.navbar__brand,
2526+
.navbar__items,
2527+
.navbar__item {
2528+
margin: 0 !important;
2529+
padding-top: 0 !important;
2530+
padding-bottom: 0 !important;
2531+
}
2532+
2533+
.navbar {
2534+
height: auto !important;
2535+
min-height: 48px !important;
2536+
}
2537+
2538+
main,
2539+
#__docusaurus,
2540+
.main-wrapper {
2541+
margin-top: 0 !important;
2542+
padding-top: 0 !important;
2543+
}
2544+
2545+
main>*:first-child,
2546+
main>div:first-child,
2547+
.main-wrapper>*:first-child,
2548+
#__docusaurus>*:first-child,
2549+
.hero,
2550+
.hero-section,
2551+
.docs-home-hero {
2552+
margin-top: 0 !important;
2553+
padding-top: 0 !important;
2554+
}
2555+
2556+
html::before,
2557+
html::after,
2558+
body::before,
2559+
body::after,
2560+
header::before,
2561+
header::after,
2562+
.navbar::before,
2563+
.navbar::after,
2564+
.theme-doc-navbar::before,
2565+
.theme-doc-navbar::after {
2566+
content: none !important;
2567+
display: none !important;
2568+
}
2569+
}

0 commit comments

Comments
 (0)