Website content moves down after the first paint when the header is taller than the default offset
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 57/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- css, javascript
- Domínio
- frontend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- JavaScript
- Estrelas
- 6.2k
- Forks
- 492
- Merge médio
- 15h 15min
- PRs com merge (30d)
- 94
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de quarto-dev/quarto-cli
-
bootstrap enhancement themes
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
quarto-dev/quarto-cli#15421 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
quarto-dev/quarto-cli#15408 ·
Mantenedores costumam responder em até 1 dia
-
accessibility bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
quarto-dev/quarto-cli#15401 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
bug callouts docx regression
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 81/100
quarto-dev/quarto-cli#15394 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
bug lightbox
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
quarto-dev/quarto-cli#15393 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de quarto-dev/quarto-cli
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 75/100
testing-library/jest-dom#749 ·
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
-
ernst:4-klein prio:3-wacht ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
NewspeedyNL/PidLane#767 ·
Mantenedores costumam responder em até 1 dia
-
bug for-agent ready
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
WenyuChiou/agent-board#1812 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
bug help wanted Should Have ui
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
hannahro15/Musical-Match-Saga#327 · 1 comentário ·
Mantenedores costumam responder em até 1 dia