decaporg / decaporg/decap-cms

Mandatory Alt Text Field in Image and Markdown Widgets

Open
#7,071 0 comments 1 reaction 0 assignees View on GitHub
type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

**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](https://github.com/decaporg/decap-cms/issues/6326) 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](https://github.com/decaporg/decap-cms/assets/26620750/9f49beaa-9947-48f9-8fea-87b68694b60e)

![Screenshot 2024-01-30 at 10 29 06](https://github.com/decaporg/decap-cms/assets/26620750/df115874-89b1-4558-943e-e473fab18882)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.