w3c / w3c/edit-context

`EditContext.text` should not extend by default

Open
#104 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
48
Forks
13
PR merge metrics
No merged PRs in 30d

Description

As far as I know, the EditContext.text is mainly designed for text editors that use the canvas element or choose the "hidden text area" solution. This may be a good fit for them, but that's not always the case.

There are text editors that rely on solutions like Virtual DOM or Custom Elements, and in that case, the text property is unused.

With the current implementation, the text property expands itself, assuming that we would use it. However, when we are not using it, we have to clear it to avoid using extra memory.

editContext.addEventListener("textupdate", () => {
    // Clear the text to avoid unnecessary memory usage
    editContext.updateText(0, editContext.text.length, "");
});

My suggestion is to change the behavior of the text somehow to not expand by default.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the EditContext.text and updateText API entry points and any existing textupdate tests; no implementation files or test paths are identified in the issue. Compare the current default expansion behavior with the proposed non-expanding behavior, and confirm that unused text no longer requires manual clearing.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.