From 0d09f761dc0462594072c99db96f2eebdde73d62 Mon Sep 17 00:00:00 2001 From: ZouicheOmar Date: Mon, 23 Mar 2026 16:10:15 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84(frontend)=20improve=20comments=20h?= =?UTF-8?q?ighlights?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated comments styles to respect design proposal, adding distinguishable highlighting, click and hover style interactions. --- CHANGELOG.md | 4 +++ .../app-impress/doc-comments.spec.ts | 17 ++++++---- .../doc-editor/components/comments/styles.tsx | 33 ++++++++++++++++--- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 812b772b..c0ddb080 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to ## [Unreleased] +### Changed + +- 💄(frontend) improve comments highlights #1961 + ## [v4.8.3] - 2026-03-23 ### Changed diff --git a/src/frontend/apps/e2e/__tests__/app-impress/doc-comments.spec.ts b/src/frontend/apps/e2e/__tests__/app-impress/doc-comments.spec.ts index 218c63b2..e8028bdd 100644 --- a/src/frontend/apps/e2e/__tests__/app-impress/doc-comments.spec.ts +++ b/src/frontend/apps/e2e/__tests__/app-impress/doc-comments.spec.ts @@ -131,12 +131,13 @@ test.describe('Doc Comments', () => { await thread.getByRole('paragraph').first().fill('This is a comment'); await thread.locator('[data-test="save"]').click(); await expect(thread.getByText('This is a comment').first()).toBeHidden(); + await expect(editor.getByText('Hello')).toHaveClass('bn-thread-mark'); - // Check background color changed await expect(editor.getByText('Hello')).toHaveCSS( 'background-color', - 'rgba(237, 180, 0, 0.4)', + 'color(srgb 0.882353 0.831373 0.717647 / 0.4)', ); + await editor.first().click(); await editor.getByText('Hello').click(); @@ -185,6 +186,7 @@ test.describe('Doc Comments', () => { await thread.getByText('This is an edited comment').first().hover(); await thread.locator('[data-test="resolve"]').click(); await expect(thread).toBeHidden(); + await expect(editor.getByText('Hello')).toHaveCSS( 'background-color', 'rgba(0, 0, 0, 0)', @@ -196,11 +198,13 @@ test.describe('Doc Comments', () => { await thread.getByRole('paragraph').first().fill('This is a new comment'); await thread.locator('[data-test="save"]').click(); + await expect(editor.getByText('Hello')).toHaveClass('bn-thread-mark'); await expect(editor.getByText('Hello')).toHaveCSS( 'background-color', - 'rgba(237, 180, 0, 0.4)', + 'color(srgb 0.882353 0.831373 0.717647 / 0.4)', ); + await editor.first().click(); await editor.getByText('Hello').click(); @@ -208,6 +212,7 @@ test.describe('Doc Comments', () => { await thread.locator('[data-test="moreactions"]').first().click(); await getMenuItem(thread, 'Delete comment').click(); + await expect(editor.getByText('Hello')).not.toHaveClass('bn-thread-mark'); await expect(editor.getByText('Hello')).toHaveCSS( 'background-color', 'rgba(0, 0, 0, 0)', @@ -263,7 +268,7 @@ test.describe('Doc Comments', () => { await expect(otherEditor.getByText('Hello')).toHaveCSS( 'background-color', - 'rgba(237, 180, 0, 0.4)', + 'color(srgb 0.882353 0.831373 0.717647 / 0.4)', ); // We change the role of the second user to reader @@ -298,7 +303,7 @@ test.describe('Doc Comments', () => { await expect(otherEditor.getByText('Hello')).toHaveCSS( 'background-color', - 'rgba(237, 180, 0, 0.4)', + 'color(srgb 0.882353 0.831373 0.717647 / 0.4)', ); await otherEditor.getByText('Hello').click(); await expect( @@ -344,7 +349,7 @@ test.describe('Doc Comments', () => { await expect(editor1.getByText('Document One')).toHaveCSS( 'background-color', - 'rgba(237, 180, 0, 0.4)', + 'color(srgb 0.882353 0.831373 0.717647 / 0.4)', ); await editor1.getByText('Document One').click(); diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/styles.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/styles.tsx index 6d6fd56f..b2c1424c 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/styles.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/components/comments/styles.tsx @@ -8,12 +8,37 @@ export const cssComments = ( & .--docs--main-editor .ProseMirror { // Comments marks in the editor .bn-editor { - .bn-thread-mark:not([data-orphan='true']), - .bn-thread-mark-selected:not([data-orphan='true']) { - background: ${canSeeComment ? '#EDB40066' : 'transparent'}; - color: var(--c--globals--colors--gray-700); + // Resets blocknote comments styles + .bn-thread-mark, + .bn-thread-mark-selected { + background-color: transparent; } + ${canSeeComment && + css` + .bn-thread-mark:not([data-orphan='true']) { + background-color: color-mix( + in srgb, + var(--c--contextuals--background--palette--yellow--tertiary) 40%, + transparent + ); + border-bottom: 2px solid + var(--c--contextuals--background--palette--yellow--secondary); + + mix-blend-mode: multiply; + + transition: + background-color var(--c--globals--transitions--duration), + border-bottom-color var(--c--globals--transitions--duration); + + &:has(.bn-thread-mark-selected) { + background-color: var( + --c--contextuals--background--palette--yellow--tertiary + ); + } + } + `} + [data-show-selection] { color: HighlightText; }