code-input icon indicating copy to clipboard operation
code-input copied to clipboard

What should scroll?

Open WebCoder49 opened this issue 5 months ago • 3 comments

What should scroll - the textarea and pre code or the code-input element?

Currently, code-input scrolls but with a blur/focus each time a character is entered, to fix bug #93 but causing bugs #115, #117, #124.

What scrolls code-input (but no blur/focus) textarea and pre code
Branch code-input-scrolls-but-no-blur-focus let-textareas-do-their-job
Previously seen in v2.2-v2.5 (sorry for the potential breaking change; I respect Semantic Versioning better now) v1.0-v2.1
Breaking change? No Yes (changes CSS, e.g. #88)
#93 Broken 😢 Fixed
#115 Fixed Fixed
#117 Fixed Fixed
#124 Probably fixed Probably fixed
#127 Broken (not fixable at this level) Broken (not fixable at this level)
#88 Would require plugin/JS 😢 Implemented logically via CSS

The Result

Because it's a breaking change, this looks like we're going to need a new major version v3, and have the textarea and pre code scroll.

WebCoder49 avatar Jul 18 '25 11:07 WebCoder49

Some things like plugins may be backported to v2 where possible, and security vulnerability fixes will be, but where it's too difficult ordinary features or bug fixes won't be.

WebCoder49 avatar Jul 18 '25 11:07 WebCoder49

In the past I haven't used SemVer well; to be honest v2.0 and v2.1 should be treated as part of major version 1, because they contain all the functionality of version 1, just deprecated, and v2.2 should be treated as the first major version 2 version, because it gains the breaking change of changing the scrolling elements from the textarea and pre code to the code-input element. I think about this much more now...

WebCoder49 avatar Jul 18 '25 11:07 WebCoder49

Another core architectural shift that is likely to be in major version 3 is using the textarea as the main target on which JavaScript code acts (but still using a separate element around it rather than <textarea is="" for WebKit compatibility). This would:

  • make the library slimmer as the textarea interface no longer needs to be proxied through the CodeInput class;
  • allow the fallback textarea to be more logically interpreted, and used later as the registered textarea (right now they're separate for backwards compatibility with beforeElementsAdded plugin callback);
  • make single-line templates etc. have an easier interface: swap the textarea for an input element. Everyone, please let me know what you think of this.

WebCoder49 avatar Aug 16 '25 23:08 WebCoder49