Skip to content

Commit 67b0e23

Browse files
ClearlyClairehiyuki2578
authored andcommitted
Fix public hashtag timeline width on mobile, fix scrollbar width compensation (mastodon#9824)
* Fix hashtag timeline width being potentially larger than window width * Add automatic computation of scrollbar width
1 parent b7d3c1e commit 67b0e23

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

app/javascript/packs/public.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,14 @@ function main() {
108108
if (parallaxComponents.length > 0 ) {
109109
new Rellax('.parallax', { speed: -1 });
110110
}
111+
112+
if (document.body.classList.contains('with-modals')) {
113+
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
114+
const scrollbarWidthStyle = document.createElement('style');
115+
scrollbarWidthStyle.id = 'scrollbar-width';
116+
document.head.appendChild(scrollbarWidthStyle);
117+
scrollbarWidthStyle.sheet.insertRule(`body.with-modals--active { margin-right: ${scrollbarWidth}px; }`, 0);
118+
}
111119
});
112120

113121
delegate(document, '.webapp-btn', 'click', ({ target, button }) => {

app/javascript/styles/mastodon/about.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ $small-breakpoint: 960px;
364364

365365
@media screen and (max-width: $column-breakpoint) {
366366
.grid {
367-
grid-template-columns: auto;
367+
grid-template-columns: 100%;
368368

369369
.column-0 {
370370
display: block;

0 commit comments

Comments
 (0)