Problem/Motivation
When configuring an SVG Image Field with the "Alt field" enabled and "Alt field required" setting checked, the validation does not work correctly. Users can upload an SVG file, leave the alternative text field empty, and save the form without any validation error.
Steps to reproduce
- Create or edit a content type/block type with an SVG Image Field
- In the field settings, enable "Alt field" and check "Alt field required"
- Save the field configuration
- Go to create/edit content using this field
- Upload an SVG file
- Leave the "Alternative text" field empty
- Click Save
Expected behavior:
A validation error should appear: "Alternative text field is required." and the form should not submit.
Actual behavior:
The form saves successfully without any validation error, allowing content with missing alt text to be created.
Comments
Comment #3
n.ghunaim commentedComment #4
jwilson3Please add a test that demonstrates the bug and validates the fix. With GitLab CI we now have a way to run only tests, without the fix.
Comment #6
a sahil madan goud commentedI’ve added a functional test covering the required alt text validation for SVG uploads.
Please let me know if any changes are needed.
Comment #7
jwilson3Thanks for adding the tests! It needs a little more work though.