fix(password) use the numeric input mode when only digits are required

Fixes: https://github.com/jitsi/brave-tracker/issues/101
This commit is contained in:
Saúl Ibarra Corretgé
2023-06-16 13:11:02 +02:00
committed by Saúl Ibarra Corretgé
parent 2292ebe762
commit 48e1f443ea
2 changed files with 16 additions and 6 deletions

View File

@@ -140,22 +140,29 @@ class PasswordForm extends Component<IProps, IState> {
* @returns {ReactElement}
*/
_renderPasswordField() {
if (this.props.editEnabled) {
let placeHolderText = this.props.t('dialog.password');
const {
editEnabled,
passwordNumberOfDigits,
t
} = this.props;
if (this.props.passwordNumberOfDigits) {
if (editEnabled) {
let placeHolderText = t('dialog.password');
if (passwordNumberOfDigits) {
placeHolderText = this.props.t('passwordDigitsOnly', {
number: this.props.passwordNumberOfDigits });
number: passwordNumberOfDigits });
}
return (
<div
className = 'info-password-form'>
<Input
accessibilityLabel = { this.props.t('info.addPassword') }
accessibilityLabel = { t('info.addPassword') }
autoFocus = { true }
id = 'info-password-input'
maxLength = { this.props.passwordNumberOfDigits }
maxLength = { passwordNumberOfDigits }
mode = { passwordNumberOfDigits ? 'numeric' : undefined }
onChange = { this._onEnteredPasswordChange }
onKeyPress = { this._onKeyPress }
placeholder = { placeHolderText }