AlaskaAirlines / auro-input

Custom HTML element for inputting string data in forms

Home Page:https://auro.alaskaair.com/components/auro/input

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Value is not displayed if pattern is invalid

zmoore-alaskaair opened this issue · comments

Describe the bug

When an auro-input element has a value, but the pattern property is not valid regex, the value will not be rendered.

To Reproduce

Make an auro-input with an invalid regex pattern.
[a-zA-Z0-9]{9, 25} note space between length constraints

Expected behavior

Perhaps a different error, or some other notification mechanism when this happens. I would expect the value to always be displayed if it's present, regardless of whether or not it matches the pattern.

Screenshots

Invalid regex [a-zA-Z0-9]{9, 25}:
image

Valid regex [a-zA-Z0-9]{9,25} (no space between length constraints):
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 109

Smartphone (please complete the following information):

Untested

Additional context

Perhaps a separate issue, but the validateInputAttributes method of the base-input doesn't document that you can only use the pattern, or the length attributes, but not both. The pattern gets evaluated first as the if in an if-elseif-elseif.

The issue you are describing isn't a bug per-say as the element is working as intended. If I understand this correctly, you are looking for a new feature that evaluates the accuracy of the regex?

When this is picked up, please compare to behavior of standard HTML input fields to inform our path forward.