-
Notifications
You must be signed in to change notification settings - Fork 36
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
🐞 - Add configurable parameter minusSign
to Number
#969
Comments
@nsbarsukov I would like to use |
Mask is used to format a number. Formatted numbers display 'minus' sign, rather than 'hyphen' sign which you would usually expect when typing on a keyboard. This is better for accessibility with screen reader, as well as typographically correct. However it might cause issues when working with the value. Use |
@nsbarsukov I believe that accessibility and typographic correctness should align with the interpreter's behavior and not impose unnecessary challenges on developers. Such behavior should be optional, left to the developer's discretion rather than enforced by default. At the moment, developers are presented with the following challenges:
Why suggest a default behavior that might be more accessible and typographically correct when it essentially serves as a "one-size-fits-all" approach? It seems more prudent to allow developers the flexibility to opt into such behavior based on their specific use cases. This ensures a balance between accessibility, typographic correctness, and developer empowerment. |
@framasev okey, we will add configurable parameter import {maskitoNumberOptionsGenerator} from '@maskito/kit';
const options = maskitoNumberOptionsGenerator({
minusSign: '-',
}); It will be remain |
minusSign
to Number
Your numeric validators wouldn't work as expected anyway, though, because they will be unable to parse thousand separators: And manual conversion is required anyway if you need a |
@waterplea You are right. In any case, disabling the formatting of Regarding the masking directive, does it support different values for the model and the displayed value in the input, relying, for example, on flags like |
Generally speaking it's impossible to maintain a masked and unmasked couple, and current directive is the general one. A dedicated number directive can easily be implemented extending default accessor: |
Closed by #1118 |
Which package(s) are the source of the bug?
@maskito/kit
Playground Link
https://stackblitz.com/edit/angular-8ndsd9?file=src%2Fmain.ts
Description
When using the
maskitoNumberOptionsGenerator
mask, hyphen minus (U+002d
) is transformed to minus sign (U+2212
) causing coercion errors:For example, these custom validators causing errors because of
NaN
(and in a server side -illegal character
):See tc39/proposals#37.
Maskito version
2.0.0
Which browsers have you used?
Which operating systems have you used?
The text was updated successfully, but these errors were encountered: