From 2a1514510a707fb27f7fd5486f07ef8873e68bea Mon Sep 17 00:00:00 2001 From: Alex Ross <38270282+alexr00@users.noreply.github.com> Date: Mon, 30 Nov 2026 17:08:07 +0100 Subject: [PATCH] Fix review comment header size --- webviews/editorWebview/index.css | 6 ++-- webviews/editorWebview/test/timeline.test.tsx | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/webviews/editorWebview/index.css b/webviews/editorWebview/index.css index 63c0a51e93..1870e2dfd7 100644 --- a/webviews/editorWebview/index.css +++ b/webviews/editorWebview/index.css @@ -1963,10 +1963,10 @@ h3 { font-weight: normal; } -/* Markdown headings, lists, and inline code follow github.com's markdown styles. */ +/* Markdown headings, lists, and inline code follow github.com's markdown styles. The headers of comments in a review are in their review's comment body. */ .comment-body h1, .comment-body h2, -.comment-body h3, +.comment-body h3:not(.review-comment-header), .comment-body h4, .comment-body h5, .comment-body h6 { @@ -1992,7 +1992,7 @@ h3 { font-size: 1.5em; } -.comment-body h3 { +.comment-body h3:not(.review-comment-header) { font-size: 1.25em; } diff --git a/webviews/editorWebview/test/timeline.test.tsx b/webviews/editorWebview/test/timeline.test.tsx index f6e1deced0..6bf3cbe622 100644 --- a/webviews/editorWebview/test/timeline.test.tsx +++ b/webviews/editorWebview/test/timeline.test.tsx @@ -4,6 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { default as assert } from 'assert'; +import { readFileSync } from 'fs'; +import * as path from 'path'; import * as React from 'react'; import { cleanup, render } from 'react-testing-library'; import { createSandbox, SinonSandbox } from 'sinon'; @@ -169,6 +171,33 @@ describe('Timeline', function () { ]); }); + it('styles the headers of comments in a review like other comment headers', function () { + const styles = ['common/common.css', 'editorWebview/index.css'].map(file => { + const style = document.createElement('style'); + style.textContent = readFileSync(path.resolve('webviews', file), 'utf8'); + return document.head.appendChild(style); + }); + try { + const view = renderTimeline([{ + id: 1, event: EventType.Reviewed, submittedAt: start, body: '', htmlUrl: '', user: bob, authorAssociation: 'MEMBER', state: 'COMMENTED', + comments: [{ + id: 2, pullRequestReviewId: 1, path: 'file.ts', position: 1, diffHunk: '', body: '### Heading', bodyHTML: '

Heading

', + url: '', htmlUrl: '', graphNodeId: 'comment', createdAt: start, user: carol, + }], + }]); + + const [reviewHeader, commentHeader] = Array.from(view.container.querySelectorAll('.review-comment-header'), header => { + const { fontSize, fontWeight, lineHeight, marginTop, marginBottom } = window.getComputedStyle(header); + return { fontSize, fontWeight, lineHeight, marginTop, marginBottom }; + }); + assert(commentHeader); + assert.deepStrictEqual(commentHeader, reviewHeader); + assert.strictEqual(window.getComputedStyle(view.container.querySelector('.markdown-body h3')!).fontSize, '1.25em'); + } finally { + styles.forEach(style => style.remove()); + } + }); + it('renders review dismissal, auto-merge, and merge queue events with their reasons', function () { const view = renderTimeline([ { id: '1', event: EventType.ReviewDismissed, actor: alice, createdAt: start, reviewAuthor: bob, dismissalMessage: 'Outdated feedback' },