-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(feedback): Wrap long error messages in the feedback dialog #23004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Souptik96
wants to merge
1
commit into
getsentry:develop
Choose a base branch
from
Souptik96:fix/14930-feedback-error-message-wrap
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+43
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/feedback/test/modal/components/Dialog.css.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /** | ||
| * @vitest-environment jsdom | ||
| */ | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { createDialogStyles } from '../../../src/modal/components/Dialog.css'; | ||
|
|
||
| /** | ||
| * Returns the declarations inside the first rule block matching `selector`, so | ||
| * assertions target one rule rather than the whole stylesheet. | ||
| */ | ||
| function getRuleBlock(css: string, selector: string): string { | ||
| const escaped = selector.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| const match = new RegExp(`^${escaped}\\s*\\{([^}]*)\\}`, 'm').exec(css); | ||
| return match ? match[1] : ''; | ||
| } | ||
|
|
||
| describe('createDialogStyles', () => { | ||
| it('lets long error messages wrap instead of overflowing the dialog', () => { | ||
| const css = createDialogStyles().textContent ?? ''; | ||
| const rule = getRuleBlock(css, '.form__error-container'); | ||
|
|
||
| // Guard: if the selector is renamed, fail loudly rather than pass vacuously. | ||
| expect(rule).not.toBe(''); | ||
| // `FeedbackErrorMessages` lets integrators supply arbitrary error copy, and | ||
| // the container is only 272px wide while the screenshot editor is open, so a | ||
| // single long token must be breakable. | ||
| expect(rule).toMatch(/overflow-wrap:\s*break-word/); | ||
| }); | ||
|
|
||
| it('keeps the error colour tokens on the same rule', () => { | ||
| const css = createDialogStyles().textContent ?? ''; | ||
| const rule = getRuleBlock(css, '.form__error-container'); | ||
|
|
||
| expect(rule).toMatch(/color:\s*var\(--error-color\)/); | ||
| expect(rule).toMatch(/fill:\s*var\(--error-color\)/); | ||
| }); | ||
|
|
||
| it('applies the nonce when one is supplied', () => { | ||
| expect(createDialogStyles('abc123').getAttribute('nonce')).toBe('abc123'); | ||
| expect(createDialogStyles().hasAttribute('nonce')).toBe(false); | ||
| }); | ||
| }); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap fix ineffective in flex layout
Medium Severity
overflow-wrap: break-wordon.form__error-containerdoes not reduce min-content size, so nested flex items (.form__top,.form__label, and thefieldset.form__rightcolumn) keepmin-width: autoand still expand past the 272px panel. Long tokens can keep overflowing—especially in Firefox, where this was reported—so the dialog overflow likely remains.Reviewed by Cursor Bugbot for commit abd0224. Configure here.