Skip to content

chore(fe): remove Text pseudo-element padding#7665

Merged
jmelahman merged 1 commit intomainfrom
jamison/rm-2px-padding
Jan 22, 2026
Merged

chore(fe): remove Text pseudo-element padding#7665
jmelahman merged 1 commit intomainfrom
jamison/rm-2px-padding

Conversation

@jmelahman
Copy link
Copy Markdown
Contributor

@jmelahman jmelahman commented Jan 22, 2026

Description

There are also cases where padding in the pseudo-elements is causing undesired behavior, https://onyx-company.slack.com/archives/C0832RVRVG8/p1769050433567939.

It may be possible to use pseudo-elements in combination with this box-decoration-clone, but also, I think my proposal to require children props of the Text to be inline-able type (strings, numbers, etc. not ReactNodes) is valid.

Either case requires a bit of work, so let's get something temporary in.

I'm also down to re-apply this to the Tag directly. I don't think that's the proper long-term solution, but I agree it's better than this current behavior.

Additional Options

  • Override Linear Check

Summary by cubic

Removed before/after pseudo-element padding from Text to stop unintended horizontal spacing and 2px offsets when used with other padded elements or Tags. This makes Text spacing consistent and avoids layout glitches in inline contexts.

Written for commit 56e4095. Summary will update on new commits.

@jmelahman jmelahman requested a review from a team as a code owner January 22, 2026 03:44
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 22, 2026

Greptile Overview

Greptile Summary

Reverts the pseudo-element padding approach that was added in PR #7226. The change removes the before and after pseudo-elements that applied 2px horizontal padding to the Text component.

  • Removed before:content-[''] before:inline-block before:pl-[2px] classes
  • Removed after:content-[''] after:inline-block after:pr-[2px] classes
  • Addresses reported issues where pseudo-element padding caused undesired spacing behavior when Text is used with other padded elements like Tag
  • The PR description suggests the author is open to re-applying padding directly to specific components like Tag if needed

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk - it's a clean revert of a recent change
  • The change removes problematic pseudo-element padding that was causing layout issues. Since it's reverting a recent addition (commit 3b75093 from Jan 7, 2026), it essentially returns the component to a previously working state. The Text component is widely used throughout the codebase, but the removal of these pseudo-elements should fix the reported spacing issues rather than introduce new ones
  • No files require special attention - this is a straightforward removal of CSS classes

Important Files Changed

Filename Overview
web/src/refresh-components/texts/Text.tsx Removed pseudo-element padding (before/after 2px) that was causing spacing issues with inline elements

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Text as Text Component
    participant DOM as DOM/Browser
    
    Note over Dev,DOM: Previous Implementation (with pseudo-elements)
    Dev->>Text: Render Text with content
    Text->>DOM: Apply before::pl-[2px] pseudo-element
    Text->>DOM: Render text content
    Text->>DOM: Apply after::pr-[2px] pseudo-element
    DOM-->>Dev: Result: 2px + content + 2px (causes offset issues)
    
    Note over Dev,DOM: Current Implementation (no pseudo-elements)
    Dev->>Text: Render Text with content
    Text->>DOM: Render text content directly
    DOM-->>Dev: Result: content only (consistent spacing)
Loading

@jmelahman jmelahman merged commit 4bc08e5 into main Jan 22, 2026
76 of 78 checks passed
@jmelahman jmelahman deleted the jamison/rm-2px-padding branch January 22, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant