sindresorhus/refined-github

`fitTextarea` taking a long time on long PRs #3031

vjpr posted onGitHub


Workaround

Disable fit-textareas feature.

posted by vjpr almost 5 years ago

Yes this is an issue with the way the fit-textarea module works:

  1. Resets height
  2. Calculates minimum height
  3. Sets height again

This happens for every keystroke.

The alternative way textareas are generally fit to content is to

  1. create a copy of the textarea as a div
  2. calculate its height
  3. update the textarea once, only when it changes.

Side note: GitHub technically has this feature already but it’s limited in height (hardcoded) and doesn’t work as well (it always leaves a 5px extra that causes the scroll bar to appear).

Does the native “fit to content” also cause this issue?

posted by fregante almost 5 years ago

If you disable fit-textareas, you can fix most of GitHub’s native feature with just this CSS:

textarea.js-size-to-fit {
    max-height: none !important; /* Increases the size limit */ 
    box-sizing: content-box; /* Fixes unnecessary scrollbar */
    width: calc(100% - 18px); /* Fixes unnecessary scrollbar */
}

However this still leaves 2 issues:

  • there's still a height limit (maybe 600px?)
  • once the limit is reached, the textarea completely stop resizing

Unfortunately these 2 issues make fit-textareas still worth having in Refined GitHub, so it would be great to improve https://github.com/fregante/fit-textarea

posted by fregante almost 5 years ago
posted by fregante over 4 years ago

Fund this Issue

$0.00
Funded

Pull requests