codefloe/forgejo-codefloe
Watch
4
12
Fork
You've already forked forgejo-codefloe
0

fix(repo): keep the Markdown outline out of the live DOM until it opens #225

Merged
pat-s merged 1 commit from fix/outline-template-e2e into v16.0/forgejo-codefloe 2026-10-06 09:17:42 +00:00
Owner

Fixes the test-e2e (1/2) failure on v16.0/forgejo-codefloe (https://codefloe.com/codefloe/forgejo-codefloe/actions/runs/1679/jobs/3/attempt/2).

Cause

The Markdown outline popup from #221 was rendered as a hidden <div>, so every heading text existed twice in the page.
Upstream repo-new.test.e2e.ts › New repo: initialize later types # Heading\n\nHello Forgejo! into the editor; on Mobile Chrome the newlines get lost, so the text ends up in the <h1>.
getByText('Hello Forgejo!') then matched both the heading and the hidden outline link, which is a strict mode violation (Playwright counts hidden elements too).

Fix

  • templates/repo/codefloe_file_outline_popup.tmpl: wrap the popup in a <template>, so its content is not part of the live DOM.
  • web_src/js/codefloe/file-outline.js: on first click, move the template content into the tippy instead of un-hiding a sibling.
  • tests/integration/codefloe_file_outline_test.go: point the README assertion at the template.
  • README.md: append this PR to the Markdown outline row.

The upstream test stays untouched.

Verification

  • Without the fix, repo-new.test.e2e.ts fails locally with the same strict mode violation on Mobile Chrome; with it, all 18 pass (chromium, firefox, Mobile Chrome).
  • codefloe-file-outline.test.e2e.ts: 6/6 pass.
  • TestFileOutline and TestViewRepoDirectoryReadme pass; file-outline.test.js 6/6; prek hooks pass.
Fixes the `test-e2e (1/2)` failure on `v16.0/forgejo-codefloe` (https://codefloe.com/codefloe/forgejo-codefloe/actions/runs/1679/jobs/3/attempt/2). ## Cause The Markdown outline popup from #221 was rendered as a hidden `<div>`, so every heading text existed twice in the page. Upstream `repo-new.test.e2e.ts` › `New repo: initialize later` types `# Heading\n\nHello Forgejo!` into the editor; on Mobile Chrome the newlines get lost, so the text ends up in the `<h1>`. `getByText('Hello Forgejo!')` then matched both the heading and the hidden outline link, which is a strict mode violation (Playwright counts hidden elements too). ## Fix - `templates/repo/codefloe_file_outline_popup.tmpl`: wrap the popup in a `<template>`, so its content is not part of the live DOM. - `web_src/js/codefloe/file-outline.js`: on first click, move the template content into the tippy instead of un-hiding a sibling. - `tests/integration/codefloe_file_outline_test.go`: point the README assertion at the template. - `README.md`: append this PR to the Markdown outline row. The upstream test stays untouched. ## Verification - Without the fix, `repo-new.test.e2e.ts` fails locally with the same strict mode violation on Mobile Chrome; with it, all 18 pass (chromium, firefox, Mobile Chrome). - `codefloe-file-outline.test.e2e.ts`: 6/6 pass. - `TestFileOutline` and `TestViewRepoDirectoryReadme` pass; `file-outline.test.js` 6/6; prek hooks pass.
fix(repo): keep the Markdown outline out of the live DOM until it opens
All checks were successful
testing / frontend-checks (pull_request) Successful in 1m21s
testing / backend-checks (pull_request) Successful in 3m53s
testing / test-unit (pull_request) Successful in 4m30s
testing / test-e2e (2/2) (pull_request) Successful in 5m50s
testing / test-e2e (1/2) (pull_request) Successful in 6m29s
testing / test-pgsql (2/4) (pull_request) Successful in 6m24s
testing / test-pgsql (1/4) (pull_request) Successful in 7m33s
testing / test-pgsql (3/4) (pull_request) Successful in 9m1s
issue-labels / backporting (pull_request_target) Has been skipped
milestone / set (pull_request_target) Has been skipped
testing / test-pgsql (4/4) (pull_request) Successful in 8m59s
3233b483e6
The outline popup from #221 was rendered as a hidden div, so every heading text existed twice in the page.
Text lookups that ignore visibility now matched both copies: upstream `repo-new.test.e2e.ts` › `New repo: initialize later` failed on Mobile Chrome with a strict mode violation on `getByText('Hello Forgejo!')`, because the dropped newlines there turn that text into part of the heading.

- Render the popup inside a `<template>` and move its content into the tippy on first click.
- Point the README assertion in `TestFileOutline` at the template.
- Append this pull request to the Markdown outline row in the README.
pat-s scheduled this pull request to auto merge when all checks succeed 2026-10-06 09:05:26 +00:00
pat-s merged commit 16b34683d1 into v16.0/forgejo-codefloe 2026-10-06 09:17:42 +00:00
pat-s deleted branch fix/outline-template-e2e 2026-10-06 09:17:42 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
codefloe/forgejo-codefloe!225
No description provided.