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 #41

Merged
merged 4 commits into from
Dec 16, 2024

Conversation

arnaucasau
Copy link
Contributor

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:.

@coveralls
Copy link

coveralls commented Dec 3, 2024

Pull Request Test Coverage Report for Build 12259315108

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 12026078671: 0.0%
Covered Lines: 577
Relevant Lines: 577

💛 - Coveralls

@arnaucasau arnaucasau marked this pull request as draft December 5, 2024 08:43
@arnaucasau arnaucasau marked this pull request as ready for review December 10, 2024 15:51
@Eric-Arellano Eric-Arellano added the stable backport potential Label for mergify to open a backport PR label Dec 16, 2024
@Eric-Arellano Eric-Arellano merged commit 94454ee into Qiskit:main Dec 16, 2024
15 checks passed
mergify bot pushed a commit that referenced this pull request Dec 16, 2024
In order to meet the [IBM Accessibility Requirements](https://www.ibm.com/able/requirements/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:`.

(cherry picked from commit 94454ee)
@mrossinek
Copy link
Member

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.

I don't understand this. If all current images can be left as-is without any alt text, is this a high priority or not?
If it is a high priority, adding alt text to the existing images should be, too, and merging of this PR was pre-maturely.
If it is not a high priority, why did this PR have to get merged before adding alt text to those images?

Given the state of it now, please open an issue (or a PR) to ensure that alt text does get added to the currently allow-listed images. Without a tracking issue, I don't see anyone coming back to this in the future.

@Eric-Arellano
Copy link
Collaborator

Eric-Arellano commented Dec 17, 2024

Hey @mrossinek , pardon me merging before you intended!

It is high priority to fix - Becky has been making good progress on ensuring all 9 APIs on docs.quantum.ibm.com have alt text. She hasn't gotten to this repo yet, but plans to as part of Qiskit/documentation#2408. It's a top priority for the docs team.

*We wanted to land this in the meantime for two reasons:

  1. Ensure no new regressions are introduced
  2. Make it easier for Becky to find the violations and fix them

@mrossinek
Copy link
Member

No worries at all, I'm glad this is moving along while I'm busy elsewhere and did not have time to review 👍

Simply wanted to follow-up on this, as it caught my eye and I didn't see any discussion around potential follow-ups 👍
Seems like you have that all laid out though 🙂

mrossinek pushed a commit that referenced this pull request Dec 19, 2024
In order to meet the [IBM Accessibility Requirements](https://www.ibm.com/able/requirements/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:`.

(cherry picked from commit 94454ee)

Co-authored-by: Arnau Casau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable backport potential Label for mergify to open a backport PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants