Adding to the question.
The role alert is not enough because screen readers read only 1 role alert at a time.
The error message should explain the problem “please fill you name” and it should be linked to the field using aria-describedby.
In addition, the focus should be set on the first invalid field.
This is the best practice to handle error messages.
Is there a way to add an ID to the error messages + aria-describedby?
Thanks.