Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[invokers] setRangeText for textarea and inputs #1062

Open
johannesodland opened this issue Jun 13, 2024 · 2 comments
Open

[invokers] setRangeText for textarea and inputs #1062

johannesodland opened this issue Jun 13, 2024 · 2 comments

Comments

@johannesodland
Copy link

johannesodland commented Jun 13, 2024

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 invoketarget=textarea invokeaction=setRangeText value="«">«</button>
<button invoketarget=textarea invokeaction=setRangeText 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//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.

@lukewarlow
Copy link
Collaborator

Instead of invokeargument we could use the value attribute from the button?

I'm hesitant to overload invokers too much but this could be a nice addition, worth considering at least.

@johannesodland
Copy link
Author

Instead of invokeargument we could use the value attribute from the button?

That sounds like a much better idea. I've updated the issue text to use the value attribute.

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants