TwitterTextEditor icon indicating copy to clipboard operation
TwitterTextEditor copied to clipboard

Stop typing from keyboard

Open vishaldroisys opened this issue 2 years ago • 1 comments

Hello,

How to stop typing from keyboard?

We have limit to stop typing from particular limit like 1500 character.

Thanks in advance.

vishaldroisys avatar Jan 09 '23 11:01 vishaldroisys

This is techinically possible, yet not recommend in terms of UI/UX standing point.

Preventing typing causes many issues for those who're using Input Method (a program that is used for typing non-English characters,) such as typing Japanese, Chinese, or other consideration is those who're using accessibility features.

The recommended implementation for such use case e.g. limiting the length of user's input is not limiting keyboard typing instead, limiting "commit" the typed text. For example, if the text is in a kind of form view, change the "Done" or "Submit" button isEnabled of the borm to not let users to commit the text if it's exceeding the limit of length. It would be also better to communicate users why they can't commit the text e.g. changing text color where the exceeded characters. You can implement such behavior by using TextEditorViewTextAttributesDelegate.

niw avatar Jan 11 '23 11:01 niw