Skip to content

Commit fc2b206

Browse files
committed
fix: don't stack multiple phone header controls on top of each other
App-primaryControl is an extension point, so a page can carry several header controls — core's 'start discussion' button plus, say, an extension's follow button on a tag page. On phones each one is positioned absolutely against the right edge, so they rendered on top of one another as a single smudged glyph. Where the controls share a parent — they are list items of the same nav — that parent now becomes a right-anchored flex row and the controls return to relative positioning, letting the browser lay them out side by side at whatever width each one is. Selected with :has() so it only applies when a second control is actually present; pages with a single control keep their existing geometry exactly. Measured at 390px: the tag page's two controls went from both occupying 339-390 to 288-339 and 339-390; index, discussion and user pages are byte-identical.
1 parent b3ec202 commit fc2b206

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

framework/core/less/common/App.less

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,29 @@
5353
width: 40px;
5454
}
5555
}
56+
// `App-primaryControl` is an extension point, so a page can carry several
57+
// controls (core's "start discussion" plus, say, an extension's follow
58+
// button). Each is absolutely positioned against the right edge, which
59+
// stacks them on top of one another. Where they share a parent — they are
60+
// list items of the same nav — that parent becomes a right-anchored flex
61+
// row instead, so the browser lays them out side by side at whatever width
62+
// each one happens to be.
63+
:has(> .App-primaryControl ~ .App-primaryControl) {
64+
position: absolute;
65+
z-index: calc(~"var(--zindex-header) + 1");
66+
top: 0;
67+
right: 0;
68+
display: flex;
69+
70+
.App.affix &, .Composer & {
71+
position: fixed;
72+
}
73+
74+
> .App-primaryControl {
75+
position: relative !important;
76+
right: auto;
77+
}
78+
}
5679
.App-primaryControl {
5780
width: auto;
5881
right: 0;

0 commit comments

Comments
 (0)