projectwallace / projectwallace/projectwallace.com

Use `OpaqueRange` for highlighting textarea when supported

Open
#379 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

components platform: code improvement platform: performance
Dominant language
Svelte
Stars
3
Forks
0
Avg merge
1d 7h
Merged PRs (30d)
11

Description

This could be a performance benefit for (for know only) Blink-based browsers that wouldn't need to copy the entire textarea contents into an extra div, sync the changes and perform the highlighting on that element.

See

Example from https://olliewilliams.xyz/blog/opaquerange/:

const input = document.querySelector('input[type="text"]');
const startIndex = input.value.indexOf("example");
const myOpaqueRange = input.createValueRange(startIndex, startIndex + "example".length);
const greenHighlights = new Highlight(myOpaqueRange);
CSS.highlights.set("green", greenHighlights);

Contributor guide

No contributing guide indexed for this repository

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

Read the OpaqueRange blog post and Microsoft Edge explainer first, then locate the textarea highlighting implementation that currently copies contents into an extra div. Check how Blink support can be detected and preserve the existing approach as a fallback; done means supported Blink browsers highlight without that extra copy and other browsers continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.