Website content moves down after the first paint when the header is taller than the default offset
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 57/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- css, javascript
- 领域
- frontend
调研方向
Start with the named rules in src/resources/projects/website/navigation/quarto-nav.scss and the initialization code in src/resources/projects/website/navigation/quarto-nav.js; compare when the content offset and announcement visibility are set against the first paint. Reproduce with the provided website configuration and inspect layout shifts in Chrome’s Performance panel. Done means #quarto-content stays at the same position when the announcement appears or a taller navbar is used.
由索引模型根据 Issue 内容生成。
描述
I have:
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
On a website with a fixed navbar, the content moves down a short time after each page loads.
The body gets a fixed top padding from CSS, sized for a one-row navbar.
The real padding, from the height of the header, comes from quarto-nav.js on DOMContentLoaded.
The announcement bar also stays hidden until DOMContentLoaded.
The browser paints the page before that event.
So when the header is taller than the CSS value, the content jumps once the script runs.
An announcement, a navbar that wraps on a small screen, or a theme with a taller navbar all trigger it.
- https://github.com/quarto-dev/quarto-cli/blob/46e6170207c64320451925d272f31ce7083305cc/src/resources/projects/website/navigation/quarto-nav.scss#L859-L861
- https://github.com/quarto-dev/quarto-cli/blob/46e6170207c64320451925d272f31ce7083305cc/src/resources/projects/website/navigation/quarto-nav.js#L18-L29
- https://github.com/quarto-dev/quarto-cli/blob/46e6170207c64320451925d272f31ce7083305cc/src/resources/projects/website/navigation/quarto-nav.js#L141-L147
The CSS offset came with the fix for #491, before the announcement bar existed (#7517), so the bar is not part of it.
A small inline script right after the header could set the offset and show the bar before the content is parsed.
Related: #491, #7517.
Steps to reproduce
_quarto.yml:
project:
type: website
website:
title: Plain
navbar:
left:
- href: index.qmd
text: Home
- href: about.qmd
text: About
announcement:
content: "A note for readers."
index.qmd and about.qmd each hold a title and one line of text.
Render the site, open _site/about.html in Chrome, and record the layout shifts (DevTools, Performance panel).
Actual behavior
#quarto-content is first painted at y = 64px, then moves to y = 101px when the announcement appears and the padding is updated.
The recording below loads Home, About, then Home again.
On each load the page is painted without the bar, then the bar appears and the content drops.
The server pauses 1.5 seconds in the middle of each page to make the jump easy to see.
On a fast connection the same jump happens within about 100 ms.
https://github.com/user-attachments/assets/302ab057-7759-4626-a4cd-3dc71efd25ba
Expected behavior
#quarto-content stays where it is first painted.
Your environment
- Quarto 99.9.9 (built from
cda41021442b20964e10e265b9dcdf81f490c18e). - macOS 27.2, Chromium-based browser (Brave).
Quarto check output
Quarto 99.9.9
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.13.0: OK
Dart Sass version 1.107.1: OK
Deno version 2.9.8: OK
Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 99.9.9
commit: cda41021442b20964e10e265b9dcdf81f490c18e
- 主要语言
- JavaScript
- 星标
- 6.2k
- 派生
- 492
- 平均合并
- 15 小时 15 分钟
- 30 天内合并 PR
- 94
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
quarto-dev/quarto-cli 的其他 Issue
-
bootstrap enhancement themes
难度 2/5 1-3 小时 新手友好度 70/100
quarto-dev/quarto-cli#15421 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
quarto-dev/quarto-cli#15408 ·
维护者通常 1 天内回复
-
accessibility bug
难度 2/5 1-3 小时 新手友好度 79/100
quarto-dev/quarto-cli#15401 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug callouts docx regression
难度 2/5 1-3 小时 新手友好度 81/100
quarto-dev/quarto-cli#15394 · 2 条评论 ·
维护者通常 1 天内回复
-
bug lightbox
难度 2/5 1-3 小时 新手友好度 76/100
quarto-dev/quarto-cli#15393 ·
维护者通常 1 天内回复
查看 quarto-dev/quarto-cli 的全部 Issue
相似的 Issue
-
bug help wanted
难度 2/5 1-3 小时 新手友好度 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
难度 2/5 1-3 小时 新手友好度 78/100
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 13 天内回复
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner scheme可能已有人在做 @Bensonbenyi 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 88/100
Mintplex-Labs/anything-llm#7338 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复