## Attach (recommended) or Link to PDF file here:
The PDF itself is semi-sensitive. I'm happy to provide via unsecured channels, just can't quite post it publicly.

## Configuration:
- Web browser and its version: Firefox 94.0.1
- Operating system and its version: Mac OS 11.6
- PDF.js version: Tested with 2.11.298 (in above Firefox) and git master (5e2aec7dd)

## What is the expected behavior? (add screenshot)
I should be able to fill AForm-validated fields with valid values:
- I should be able to type "123-45-6789" into an SSN field
- I should be able to type "867-5309" into a phone field

## What went wrong? (add screenshot)
I got validation errors instead, when trying to insert the dashes. If I try to not insert the dashes, it lets me while editing, but throws an error when leaving the field.
<img width="426" alt="Screen Shot 2021-11-24 at 11 33 53 AM" src="https://user-images.githubusercontent.com/479715/143302917-ee2f6161-616f-4138-b0af-5048fbe735f6.png">
<img width="426" alt="Screen Shot 2021-11-24 at 11 37 13 AM" src="https://user-images.githubusercontent.com/479715/143302928-741ea372-c9a1-4107-9373-94000e0622ce.png">
<img width="622" alt="Screen Shot 2021-11-24 at 11 38 29 AM" src="https://user-images.githubusercontent.com/479715/143303092-5cc0c999-9c15-4a5d-82ea-be4316bfe755.png">
<img width="622" alt="Screen Shot 2021-11-24 at 11 38 44 AM" src="https://user-images.githubusercontent.com/479715/143303099-b5da332a-c30b-4c2f-bcf6-8635ad58a6b3.png">

## Additional info

For zip codes, the while-typing validation doesn't limit length - I can type as many numbers as I want, and am only complained at once I exit the field.

I've dug into this and will open a PR shortly with more details, but there are other even stranger quirks around internal deletions/insertions as well.
const event = globalThis.event;
    if (!event.value) {
      return;
    }
    psf = this.AFMakeNumber(psf);
    if (psf === null) {
      throw new Error("Invalid psf in AFSpecial_Keystroke");
    }
    let formatStr;
    switch (psf) {
      case 0:
        formatStr = "99999";
        break;
      case 1:
        formatStr = "99999-9999";
        break;
      case 2:
        const finalLen =
          event.value.length +
          event.change.length +
          event.selStart -
          event.selEnd;
        if (finalLen >= 8) {
          formatStr = "(999) 999-9999";
        } else {
          formatStr = "999-9999";
        }
        break;