Skip to content

Draft: Fix autosizing textareas under StartupCSS mode

André Luís requested to merge andr3-fix-textarea-autosize-startupcss into master

What does this MR do?

When StartupCSS mode is enabled, the DOMContentLoaded event is fired before the content is seen. Which breaks the autosize setup process.

Instead of polling the DOM to check when it's visible, we decided to go with an event triggered when the stylesheets are activated.

This way, any other piece of code that needs to hook to this moment, can.

There are some problems with this:

  • When we run code in the bundle (like autosize.js), the custom event might've already been triggered.
  • this complicates the usage, as you can see in the autosize.js

Question: We can write a generic StartupCSS watcher that will trigger a global event either on DOMContentLoaded or later to encapsulate this logic...

  • Is it worth it?
  • Are we overthinking this?

Screenshots

On page load (edit MR)

Screenshot_2020-08-27_at_15.21.13

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports