open-ui icon indicating copy to clipboard operation
open-ui copied to clipboard

[invokers] setRangeText for textarea and inputs

Open johannesodland opened this issue 3 weeks ago • 1 comments

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 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.

johannesodland avatar Jun 13 '24 11:06 johannesodland