adobe / adobe/balance-text

Provide configuration options via the interface

Open
#99 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.4k
Forks
77
PR merge metrics
No merged PRs in 30d

Description

One limitation I've hit a couple of times has been the [5000 character limit](https://github.com/adobe-webplatform/balance-text/blob/master/balancetext.js#L388) which is somewhat arbitrary. I changed some copy from 4990 to 5010 characters the other day and it all-of-a-sudden stopped working.

Is there a philosophical reason for a limit that large? Is it based on empirical evidence? Or is it mostly just arbitrary?

Was thinking we could have a way of changing that default? Perhaps globally, as well as per-call.

```js
balanceText.config({maxTextWidth: 12345}); // global setting
balanceText(el, {maxTextWidth: 12345}); // per-call
balanceText(el, {anyTextWidth: true}); // perhaps just disable the check?
```

I'm happy to do the work if we decide this is the way to go... just thought I'd put it out there as a discussion point. Will there be other config settings we care about such that we setup a good pattern for it?

Contributor guide

Open the contributing guide

Research direction

Start by reading balancetext.js around the 5000-character check at line 388 and trace how balanceText receives its arguments. Compare the proposed global config and per-call options, then define the supported behavior for changing or disabling the limit. Done should include the agreed configuration API and coverage for the affected calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.