decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.66k stars 3.02k forks source link

Mandatory Alt Text Field in Image and Markdown Widgets #7071

Open mirhamasala opened 5 months ago

mirhamasala commented 5 months ago

Is your feature request related to a problem? Please describe.

Image alt text is crucial for SEO and accessibility, yet in both the Image and Markdown widgets, there currently seems to be no way to enforce the alt text field as mandatory. This omission can lead to scenarios where images are uploaded without the necessary alt text, which is not ideal for SEO and accessibility compliance.

Describe the solution you'd like

I propose an enhancement to make the alt text field a required field in both the Image and Markdown widgets. This feature would ensure that users cannot bypass entering the alt text when uploading images, thereby enhancing SEO and accessibility.

Describe alternatives you've considered

An interim workaround I've considered involves using separate image and string widgets as follows:

      - label: "Image"
        name: "image"
        widget: "image"
        required: true
      - label: "Image Alt Text"
        name: "alt"
        widget: "string"
        required: true

While this workaround serves the purpose, it is not as streamlined or user-friendly as having an integrated mandatory alt text field within the existing widgets.

Additional context

A related issue was discussed in this GitHub issue where the community member requested making fields within a Markdown widget required. Unfortunately, that issue was closed due to inactivity.

Screenshot 2024-01-30 at 10 27 38

Screenshot 2024-01-30 at 10 29 06