-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Fix issue #5186: [Bug]: Fix up inline code styles in chat window #5226
Conversation
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.
There is still no clear contrast between the background/font of the code block and that of the text. Please see the attached figure of the current state.

For reference, this is the prompt I used:
Let's start over. Run: `cd frontend && npm run lint:fix && npm run build ; cd ..` and fix any errors
@openhands-agent , please try to fix this.
New OpenHands update |
The workflow to fix this issue encountered an error. Please check the workflow logs for more information. |
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.
OK, this LGTM now, here is an example.

@rbren , could you take a look as the original person who reported it?
That looks nicer to me, fwiw 🎉 |
it("should apply correct styles to inline code", () => { | ||
render(<ChatMessage type="assistant" message="Here is some `inline code` text" />); | ||
const codeElement = screen.getByText("inline code"); | ||
|
||
expect(codeElement.tagName.toLowerCase()).toBe("code"); | ||
expect(codeElement.closest("article")).not.toBeNull(); | ||
}); |
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.
The test title "should apply correct styles to inline code" is unrelated to what the test actually does (check if the elements exist)
it("should apply correct styles to inline code", () => { | |
render(<ChatMessage type="assistant" message="Here is some `inline code` text" />); | |
const codeElement = screen.getByText("inline code"); | |
expect(codeElement.tagName.toLowerCase()).toBe("code"); | |
expect(codeElement.closest("article")).not.toBeNull(); | |
}); | |
it("should render inline code", () => { | |
const { rerender } = render( | |
<ChatMessage type="assistant" message="Here is some regular text" />, | |
); | |
expect(screen.queryByRole("code")).not.toBeInTheDocument(); | |
rerender( | |
<ChatMessage | |
type="assistant" | |
message="Here is some `inline code` text" | |
/>, | |
); | |
expect(screen.getByRole("code")).toBeInTheDocument(); | |
}); |
Here we check for the presence of a code
element only if the content contains backticks. We remove the check for article
since that is the message wrapper which we test various times in previous tests.
If we want to test styles, I believe we can take advantage of snapshot testing
Hey Team - Anything blocking this PR? |
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.
I think we're OK.
This pull request fixes #5186.
The issue has been successfully resolved. The AI agent made specific improvements to the inline code styling that directly address the reported concerns about font size and visual appearance:
The changes were purely CSS-based, which matches the scope of the reported issue. The agent used existing theme variables to maintain consistency with the UI, and the modifications were successfully built. The changes address all aspects of the original bug report, including font size adjustments and improving visual distinction through color and spacing modifications.
A human reviewer can verify these changes by checking that:
Automatic fix generated by OpenHands 🙌
To run this PR locally, use the following command: