Input Text pattern expression not being enforced

I have the following input_text defined. However this mask isn’t being enforced. I can enter any value, instead of requiring a 4 digit number. Is not the pattern supposed to do exactly this?

foobar:
  name: ''
  pattern: '[0-9]{4}'

You can enter any value but only a 4 digit value will be accepted.

If I create the input text exactly as you have shown, I have the exact same result … I can enter anything, and any entry is accepted. I can enter ‘abcdefg’, for example, and it will update the state to ‘abcdefg’. If you have since found a solution, please share. Thanks.