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

Feature: Prevent user from typing in input at max value #255

Open
taejs opened this issue Jan 13, 2022 · 1 comment
Open

Feature: Prevent user from typing in input at max value #255

taejs opened this issue Jan 13, 2022 · 1 comment

Comments

@taejs
Copy link

taejs commented Jan 13, 2022

Is it possible to prevent typing conditionally?
I'd like to implement a max-length feature of textarea element using editable.js.

@marcbachmann
Copy link
Member

marcbachmann commented Feb 19, 2022

No, that's not possible at the moment.
You could try setting up a beforeinput event handler on the dom element.
That one bubbles up and is cancelable.

But what we're usually doing is to extract the length and then show some warning if the value is above the limit. This results in a better behavior as it won't just cut off characters and also works the with copy/paste of text. Controlling the user input is too complicated most times.
image

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