Skip to content

Commit 771cddd

Browse files
cpoilecwarnermmesethna
authored
Fix fragment scroll margin (#8702)
* fix fragment scroll margin * fix header issues; simplify some; fix mobile notification height --------- Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com> Co-authored-by: Eric Sethna <14333569+esethna@users.noreply.github.com>
1 parent 7ecebc6 commit 771cddd

5 files changed

Lines changed: 59 additions & 81 deletions

File tree

source/_static/css/homepage-v1.css

Lines changed: 21 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/_static/css/mattermost-global.css

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,21 @@
1010
--marigold: #FFBC1F;
1111
--black-04: #5A6072;
1212
--black-05: #363A45;
13-
}
1413

15-
section[id] {
16-
scroll-margin-top: 100px;
14+
/* Header component heights */
15+
--notification-bar-height: 45px;
16+
--nav-bar-height: 73px;
1717
}
1818

19-
@media (min-width: 767.98px) {
20-
section[id] {
21-
scroll-margin-top: 150px;
22-
}
19+
body:not(.with-notification) {
20+
--notification-bar-height: 0px;
2321
}
2422

23+
/* Scroll margin for fragment navigation - positions target just below header.
24+
Must be less than Furo's Gumshoe offset (header + 2.5rem + 1) for TOC highlighting. */
25+
section[id] {
26+
scroll-margin-top: calc(var(--notification-bar-height) + var(--nav-bar-height) + 1px);
27+
}
2528

2629
.pointer-events-none {
2730
pointer-events: none;
@@ -143,42 +146,37 @@ details.mm-sbom > ul > li {
143146
/* Notification Banner */
144147

145148
.notification-bar {
149+
position: relative;
146150
color: #1B1D22;
147151
text-align: center;
148152
display: none;
149153
width: 100%;
150154
align-items: center;
151155
justify-content: center;
152-
height: 45px;
156+
height: var(--notification-bar-height);
153157
background-color: #FFBC1F;
154-
position: fixed;
155-
z-index: 9999;
156158
}
157159

158160
.notification-bar a {
159161
text-decoration: none;
160162
}
161163

162-
@media (max-width: 770px) {
163-
.notification-bar {
164-
text-align: left;
165-
/* TEMP FOR LONG COPY */
166-
height: 70px;
167-
}
168-
}
169164

170165

171166
.notification-bar.closed {
172167
display: none;
173168
}
174169

175170
.notification-bar__content {
176-
padding: 0.5rem 3rem 0.5rem 1rem;
171+
display: flex;
172+
align-items: center;
173+
padding: 0 1rem;
177174
font-family: "trade-gothic-next", "Lato", "Helvetica Neue", "Arial", sans-serif;
178175
font-weight: 700;
179176
font-size: 15px;
180177
line-height: 1.2;
181178
width: 100%;
179+
height: 100%;
182180
}
183181

184182
.notification-bar__content>div {
@@ -192,6 +190,8 @@ details.mm-sbom > ul > li {
192190
.notification-bar__wrapper {
193191
display: flex;
194192
align-items: center;
193+
justify-content: center;
194+
flex: 1;
195195
}
196196

197197
.notification-bar__wrapper a {
@@ -218,22 +218,17 @@ details.mm-sbom > ul > li {
218218
.notification-bar__close {
219219
font-size: 36px;
220220
font-weight: 300;
221-
position: absolute;
222221
cursor: pointer;
223-
right: -5px;
224222
opacity: .3;
225-
top: 0;
226-
width: 64px;
227-
line-height: 35px;
223+
order: 1;
224+
margin-left: auto;
225+
display: flex;
226+
align-items: center;
227+
justify-content: center;
228+
padding: 0 2px 10px;
228229
}
229230

230-
@media (max-width: 770px) {
231-
.notification-bar__close {
232-
/* TEMP FOR LONG COPY */
233-
right: -25px;
234-
top: 10px;
235-
}
236-
}
231+
237232

238233
.notification-bar-hide:hover {
239234
opacity: .5;
@@ -243,11 +238,6 @@ details.mm-sbom > ul > li {
243238
display: flex;
244239
}
245240

246-
247-
.with-notification .wy-grid-for-nav {
248-
padding-top: 114px;
249-
}
250-
251241
kbd {
252242
display: inline-block;
253243
border: 1px solid #ccc;
@@ -1311,6 +1301,7 @@ body:not([data-custom-theme="light"]) .site-header__col--menu .site-nav__hassubn
13111301
}
13121302

13131303
.nav-container {
1304+
position: relative;
13141305
width: 100%;
13151306
max-width: 1312px;
13161307
margin-right: auto;
@@ -2014,4 +2005,4 @@ table img[height="14"], table img[height="16"],
20142005
border: none !important;
20152006
}
20162007

2017-
/* Mermaid dark theme configured in conf.py - no custom overrides needed */
2008+
/* Mermaid dark theme configured in conf.py - no custom overrides needed */

source/_static/scss/homepage-v1.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,13 @@ body {
2525

2626
.sidebar-sticky {
2727
@media (max-width: 770px) {
28-
padding-top: 110px;
28+
padding-top: 120px;
2929
}
3030
}
3131

3232
.mobile-header {
3333
top: -15px;
3434
}
35-
36-
header {
37-
top: 45px;
38-
}
3935
}
4036
}
4137

source/_static/scss/partials/_header.scss

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ body:not([data-custom-theme="light"]) {
3535

3636
@media (max-width: 770px) {
3737
.notification-bar {
38-
height: 48px;
3938
align-items: center;
4039
}
41-
42-
.notification-bar__close {
43-
top: 0;
44-
}
4540
}

source/_templates/custom-nav.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<div data-swiftype-index=false class="notification-bar sticky-top">
2-
<div class="notification-bar__content">
3-
<a class="notification-bar__close" data-ol-has-click-handler="">
4-
<span aria-hidden="true">×</span>
5-
</a>
6-
<div class="notification-bar__wrapper">
7-
<a href="https://mattermost.com/blog/mattermost-v11-powering-more-mission-critical-collaboration/" target="_blank" class="notification-bar__link"><img src="{{ pathto('_static/images/notification-bar/icon-megaphone.svg', 1) }}" alt="">Mattermost v11.0 is now available! Learn what's new »</a>
8-
</div>
9-
</div>
10-
</div>
111
{%- if pagename == 'index' %}
122
<header class="site-header" itemscope="" itemtype="https://schema.org/WebSite">
133
{%- else %}
144
<header class="site-header site-header--not-home" itemscope="" itemtype="https://schema.org/WebSite">
155
{% endif %}
6+
<div data-swiftype-index=false class="notification-bar">
7+
<div class="notification-bar__content">
8+
<a class="notification-bar__close" data-ol-has-click-handler="">
9+
<span aria-hidden="true">×</span>
10+
</a>
11+
<div class="notification-bar__wrapper">
12+
<a href="https://mattermost.com/blog/mattermost-v11-powering-more-mission-critical-collaboration/" target="_blank" class="notification-bar__link"><img src="{{ pathto('_static/images/notification-bar/icon-megaphone.svg', 1) }}" alt="">Mattermost v11.0 is now available! Learn what's new »</a>
13+
</div>
14+
</div>
15+
</div>
1616
<div class="nav-container site-header__container">
1717
<div class="site-header__row">
1818
<div class="site-header__col--logo">

0 commit comments

Comments
 (0)