openui / openui/open-ui

[invokers] setRangeText for textarea and inputs

Open
#1,062 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-triage
Dominant language
MDX
Stars
4.5k
Forks
226
Avg merge
2d 22h
Merged PRs (30d)
4

Description

Similar to stepUp and stepDown it would be helpful to be able to invoke setRangeText to insert a string into a textarea or an input. This would require being able to pass an argument, perhaps through the value attribute.

Example:

<button commandfor=textarea command=set-range-text value="«">«</button>
<button commandfor=textarea command=set-range-text value="»">»</button>
<label for=textarea>Enter your text here:</label>
<textarea id=textarea>
  It was a dark and stormy night...
</textarea>
Original text Similar to [`stepUp` and `stepDown`](https://github.com/openui/open-ui/issues/968) it would be helpful to be able to invoke setRangeText to insert a string into a textarea or an input. This would require being able to pass an argument, perhaps through a separate attribute such as `invokeargument`.

Example:

<button invoketarget=textarea invokeaction=setRangeText invokeargument="«">«</button>
<button invoketarget=textarea invokeaction=setRangeText invokeargument="»">»</button>
<label for=textarea>Enter your text here:</label>
<textarea id=textarea>
  It was a dark and stormy night...
</textarea>
Motivation

Some UTF characters are incredibly hard to enter. If and how the user can input them depend on the users operating system, user agent and input device.

In example: As a Norwegian publisher we strive to use the correct punctuation marks. Some of the punctuation marks such as the guillemet («») quotation marks are not even available on the Norwegian keyboard. Entering the correct characters requires using keyboard combinations that are difficult to remember. Being able to provide shorthand buttons to input these characters without JS would be very helpful.

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 this issue and the related stepUp/stepDown discussion in open-ui issue 968, then compare the proposed command and value attributes with the setRangeText behavior for textarea and input elements. Done would require a resolved invocation design that passes the requested string and a documented outcome for inserting it without JavaScript.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.