Skip to content

Keyfilter on Android doesn't match complex Regex correctly #19159

@Thessi

Description

@Thessi

Describe the bug

The Keyfilter Android implementation differs from all other platforms, that also behaves differently when using it with regex.
Usually, on every input, the full content of the input gets checked against the regex. For Android specifically though, every single character gets matched against the regex separately.

Example:
Regex: ^[a-z]\d$
Input: a1
Expected behaviour (and current behaviour on all non-Android platforms): Is correct & matches regex (input doesn't get blocked with validationOnly=false)
Behaviour on Android: Is invalid, since neither "a" nor "1" matches the regex (typing the "a" would already get blocked)

Note: The provided reproducible obviously only exerts the described behaviour if run on Android.

Pull Request Link

#19160

Reason for not contributing a PR

  • Lack of time
  • Unsure how to implement the fix/feature
  • Difficulty understanding the codebase
  • Other

Other Reason

No response

Reproducer

https://stackblitz.com/edit/github-lctj1mij-mcf7drqq?file=src%2Fapp%2Fapp.component.ts

Environment

On Android devices (whenever isAndroid returns true)
First observed on a Pixel 9 with Android 15, reproduced in multiple emulators with Android 13-16

Angular version

21.0.0

PrimeNG version

v20

Node version

No response

Browser(s)

Chrome for Android, Capacitor App (Webview)

Steps to reproduce the behavior

  1. Implement a input with a complex regex (=multi part, eg. ^[a-z]\d*$) keyfilter and validationOnly=false
  2. Try to input text on Android matching the regex (eg. "a1" for the given regex)

Expected behavior

Input should be possible, as long as the full input matches the regex

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs TriageIssue will be reviewed by Core Team and a relevant label will be added as soon as possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions