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

Fix: Add alt text to index, agency index background image #1569

Merged
merged 2 commits into from
Jul 27, 2023

Conversation

machikoyasuda
Copy link
Member

fixes #1418

This PR takes a different approach from the previous PR - and avoids a lot of complications in new HTML, changing the debug bar, changing templates, etc.

Instead of changing the CSS structure, this PR simply adds an empty span tag with role="img" and aria-label with the alt tag, as suggested here: https://www.davidmacd.com/blog/alternate-text-for-css-background-images.html

image

@machikoyasuda machikoyasuda requested a review from a team as a code owner July 27, 2023 03:51
@machikoyasuda machikoyasuda self-assigned this Jul 27, 2023
@github-actions github-actions bot added deployment-dev [auto] Changes that will trigger a deploy if merged to dev i18n Copy: Language files or Django i18n framework front-end HTML/CSS/JavaScript and Django templates and removed i18n Copy: Language files or Django i18n framework labels Jul 27, 2023
@machikoyasuda
Copy link
Member Author

@thekaveman Decided to go with the span approach, because I couldn't figure out a more robust way to get the div to scale properly.

@machikoyasuda machikoyasuda added this to the Veterans milestone Jul 27, 2023
@@ -11,6 +11,7 @@
<div class="box px-4 py-3">
<h1 class="text-left p-0">{{ page.headline }}</h1>
<h2 class="p-sm pb-lg-8 pt-1 pt-lg-4 pb-4">{% translate "core.pages.landing.h2" %}</h2>
<span role="img" aria-label="{% translate "core.pages.index.alt" %}"></span>
Copy link
Member

Choose a reason for hiding this comment

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

This also has the added benefit of inlining the alt text in the most appropriate place for the user, in context with the other (primary) content on the page.

@machikoyasuda machikoyasuda merged commit 58ede9b into dev Jul 27, 2023
11 checks passed
@machikoyasuda machikoyasuda deleted the fix/veterans--refactor-index-agency-index branch July 27, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployment-dev [auto] Changes that will trigger a deploy if merged to dev front-end HTML/CSS/JavaScript and Django templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Home & Agency Index - Refactor homepage background image to use an img tag
2 participants