Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a linter to check the images' alt text #137

Closed
wants to merge 6 commits into from

Conversation

arnaucasau
Copy link
Collaborator

In order to meet the IBM Accessibility Requirements for the API docs, we need to ensure that all images have appropriate alt text so that users can understand any meaningful visuals. The alt text should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. In addition, if an image contains important words for understanding the content, the alt text should include those words as well.

This PR adds a linter to check that all images have alt text. The current invalid images, if any, have been included in an allowlist that will help us to not break CI before the text is added.

If the script detects an image without alt text, it will show an error indicating the file where the image is located and the line where we are using a sphinx directive like .. image:: or .. plot:: that generates an image. Example:

💔 Some images are missing the alt text

Errors found in qiskit_ibm_runtime/fake_provider/__init__.py:
- Error in line 34: .. plot::

Alt text is crucial for making documentation accessible to all users. It should serve the same purpose as the images on the page, conveying the same meaning rather than describing visual characteristics. When an image contains words that are important to understanding the content, the alt text should include those words as well.

To fix the error, the :alt: [Your text here] option must be added under the lines indicated in the error messages. However, If the .. plot:: directive is used, but no image is generated, you can use the option :nofigs:.

@arnaucasau arnaucasau marked this pull request as ready for review December 3, 2024 14:09
Copy link
Member

@cbjuan cbjuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@Eric-Arellano
Copy link
Collaborator

@cbjuan I think this fails CI because the PR is from a fork? I'm not sure if you want to merge on red.

@jesus-talavera-ibm
Copy link
Contributor

@cbjuan I think this fails CI because the PR is from a fork? I'm not sure if you want to merge on red.

@y4izus was working on fixing test in this PR: #128 We can wait until this one is merged

@arnaucasau
Copy link
Collaborator Author

arnaucasau commented Dec 3, 2024

Superseded by #138 to try to fix CI

@arnaucasau arnaucasau closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants