Skip to content

Make autosize fields more performant and remove broken autosize handle

username-removed-408230 requested to merge autosize-js-perf into master

In addition to autosize.js, we used to depend on a third-party library (ba-resize) to help manage the resizing of textarea elements. We added some extra event handling logic on top of autosizejs to help those libraries work together. This MR removes that extra logic, since we removed ba-resize several months ago, and because the listeners pile some DOM-heavy logic on top of what autosize.js already does, which contributes to very poor performance while keying in input on moderately large issues/MRs.

Eventually, we need to find a way to remove autosize.js completely. But since we depend heavily on it, removing it will require quite a lot of refactoring. I think this is a good first step.

The only noticeable change here will be that the resize handle will no longer be visible on textarea elements. The resizer handle doesn't even work as it should now. As you can see here, when you start typing after resizing the window, the textarea reverts to the size autosize.js sets. So the resize handler serves virtually no purpose, and hasn't for several months:

2017-07-03_15.45.47

There was general agreement in discussion on Slack that it's okay to remove, particularly since it's contributing to a performance problem. After all, the need for a resizer handle is what autosize.js aims to remove.

After this change, autosize still works as it should:

2017-07-03_15.43.29

Related to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12532d and https://gitlab.com/gitlab-org/gitlab-ce/issues/34637

Edited by username-removed-408230

Merge request reports