adobe / adobe/balance-text

::before pseudo element with display:block stops balancing

Open
#150 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
77
PR merge metrics
No merged PRs in 30d

Description

**Original Title**: ::before pseudo element used as accent stops balancing.

### Expected Behaviour
I'd like to use graphical accents for a number of headlines. If I add these using a ::before pseudo-element, I'd like the text to continue to balance.

### Actual Behaviour
When I include a ::before pseudo-element as an accent, the text is not balanced.

### Reproduce Scenario (including but not limited to)

#### Steps to Reproduce

#### Platform and Version
3.3.0 / Testing on Chrome (Mac OS)

#### Sample Code that illustrates the problem
```
h2::before {
content: "";
display: block;
background: url("images/graphic-wave.png");
background-size: contain;
width: 100px;
height: 26px;
margin-bottom: 32px;
}

balanceText('h2', {watch: true});
```

#### Logs taken while reproducing problem

Contributor guide

Open the contributing guide

Research direction

Start with the balanceText('h2', {watch: true}) call and reproduce the issue in Chrome using the provided h2::before example with display:block. Trace how the plugin measures and balances the heading when the pseudo-element is present. Done means headlines with this accent continue to balance correctly without breaking the existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.