Input-mask-ios: Fixed symbols in the mask

Created on 20 Feb 2017  ·  3Comments  ·  Source: RedMadRobot/input-mask-ios

It will be great to have the ability of fixed symbols using.

For example I need the mask for the phone number: +7 (111) 111-11-11
So according to documentation I can to create mask for this case: +7([000])[000]-[00]-[00]
And that's alright. But I need the user can't clear fist two symbols (+7). So every time "+7" have to be always visible in the text field.

enhancement question rejected

Most helpful comment

@TikhonovAlexander hey there. @razalur might be interested, too.

Thanks for reminding me about this feature request. We actually had a short talk with two evangelists from Apple about having a non-editable text inside the text field.

TL;DR: We are not going to support this feature.

It doesn't violate HIG directly though it is a bad idea to restrict user control over the app and take over the decision-making. Native text fields do not behave like that, and iOS SDK already has a component for a static text — a UILabel.

You can't disable or greyout a native keyboard Backspace button, and non-clearable symbols will bring confusion, as the end user won't be able to determine whether it is a designed behaviour or a bug. "Why exactly my Backspace button doesn't work?" — and you can't give a clear hint.

From our library design perspective, it is obvious that the developer might put a "fixed" symbol in the middle of the line. But what do you expect to happen when the user starts to delete characters from the beginning of the line?

Even more questions arise when you decide to incorporate a UITextField Clear button.
Corresponding delegate method -textFieldShouldClear() will not allow you to partially clear your text field, it is meant to erase all the text. Overriding or extending clear button behaviour is an ambiguous design decision and thus a large responsibility for our library, because we will have to cover all the use cases. Some people (developers and users) will want the native clear button to wipe out all the text, somebody will expect all the "fixed" symbols to stay after clearing, and others will assume only the "fixed" prefix should stay and "fixed" chars in the middle of the line should be erased.

The only thing I could help you with is an advice to think through the goals you are aiming to achieve.
Don't fight the SDK as the SDK always wins.

All 3 comments

Hey @razalur
Thanks for your suggestion. I will come back with feedback a bit later this week, stay tuned!

any updates ?

@TikhonovAlexander hey there. @razalur might be interested, too.

Thanks for reminding me about this feature request. We actually had a short talk with two evangelists from Apple about having a non-editable text inside the text field.

TL;DR: We are not going to support this feature.

It doesn't violate HIG directly though it is a bad idea to restrict user control over the app and take over the decision-making. Native text fields do not behave like that, and iOS SDK already has a component for a static text — a UILabel.

You can't disable or greyout a native keyboard Backspace button, and non-clearable symbols will bring confusion, as the end user won't be able to determine whether it is a designed behaviour or a bug. "Why exactly my Backspace button doesn't work?" — and you can't give a clear hint.

From our library design perspective, it is obvious that the developer might put a "fixed" symbol in the middle of the line. But what do you expect to happen when the user starts to delete characters from the beginning of the line?

Even more questions arise when you decide to incorporate a UITextField Clear button.
Corresponding delegate method -textFieldShouldClear() will not allow you to partially clear your text field, it is meant to erase all the text. Overriding or extending clear button behaviour is an ambiguous design decision and thus a large responsibility for our library, because we will have to cover all the use cases. Some people (developers and users) will want the native clear button to wipe out all the text, somebody will expect all the "fixed" symbols to stay after clearing, and others will assume only the "fixed" prefix should stay and "fixed" chars in the middle of the line should be erased.

The only thing I could help you with is an advice to think through the goals you are aiming to achieve.
Don't fight the SDK as the SDK always wins.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteynMarnus picture SteynMarnus  ·  11Comments

KompoD picture KompoD  ·  5Comments

caioremedio picture caioremedio  ·  6Comments

MrJox picture MrJox  ·  11Comments

TikhonovAlexander picture TikhonovAlexander  ·  3Comments