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

Remove horizontal layout from Featured Menu Content to fix a11y img alt issue #3647

Merged
merged 16 commits into from
Dec 12, 2017

Conversation

anselmbradford
Copy link
Member

Images inside links should have alt text that describes the link. This was failing our wcag tests.

Additions

  • Adds alt text to mega menu image links.

Testing

  1. gulp test:a11y should only show 1 error, not 5.

Screenshots

screen shot 2017-12-06 at 5 38 56 pm

@jimmynotjim
Copy link
Contributor

I thought if the alt text duplicates the content the best practice was not to use an alt text rather than have the screen reader repeat the content?

@anselmbradford
Copy link
Member Author

Well the way we have it set up the image is alone in a link, even though there's the same link with text nearby, so I'm not sure, would the screenreader jump to the link? WCAG fails it on https://achecker.ca/checker/suggestion.php?id=7

@Scotchester
Copy link
Contributor

The link should wrap both the image and heading, if possible.

@jimmynotjim
Copy link
Contributor

Ahhhh, yep, looks like we could update the markup and less to simplify the component a bunch. I think the __horizontal modifier is no longer necessary so we can eliminate all the display: table stuff.

@anselmbradford
Copy link
Member Author

@schaferjh https://[GHE]/flapjack/Modules-V1/wiki/Featured-Menu-Content has a horizontal layout for featured menu content. Is that still something we'll have at some point?

@schaferjh
Copy link
Member

@anselmbradford given how much our navigation items have expanded, I doubt it.

@anselmbradford
Copy link
Member Author

Removed horizontal layout. Ready for review again.

@anselmbradford anselmbradford changed the title Add alt text to images Remove horizontal layout from Featured Menu Content to fix a11y img alt issue Dec 11, 2017
@jimmynotjim
Copy link
Contributor

Now that the link wraps the image and the text, we really don't want alt text right?

@anselmbradford
Copy link
Member Author

Err right. Removed the alt values. wcag is failing on the images now unfortunately. Looks like it doesn't recognize the text inside the link, but it is correct according to https://achecker.ca/checker/suggestion.php?id=7

@Scotchester
Copy link
Contributor

Looks like the images need display: block;:

screen shot 2017-12-11 at 15 15 30

@anselmbradford
Copy link
Member Author

@Scotchester Fixed the image and text.

Copy link
Contributor

@Scotchester Scotchester left a comment

Choose a reason for hiding this comment

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

Left one more semantics/accessibility question, but it doesn't have to be a blocker for this PR.

It'd be nice to do some accessibility-focused user testing of our menu.

{{ value.link.text }}
</span>
</a>
</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, one more thing. Should this text be in a heading element, not a paragraph? It's a little confusing to me because it's within the navigation. I realize I'm not sure what the right way to handle headings in complex navigation is. Presumably we'd want a screen reader to read things like the "Money topics" and "Guides" headings as one tabs through the navigation, but I'm not sure if they will be, or if it just skips to links. Something to test, I suppose, but we're venturing into out-of-scope territory.

If you think we should go ahead and make it a heading here, though, I don't think a heading can contain an image, but you could probably do:

aside
    a
        img
        h4
    p

If not, though, I might suggest restructuring it that way, anyway, so you can eliminate the wrapping p.h4 and just use a div class="h4" around the {{ value.link.text }}.

Copy link
Member Author

Choose a reason for hiding this comment

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

Could I use <h4> instead of <div class="h4">? Either looks like it would eliminate the _text modifier.

Copy link
Contributor

Choose a reason for hiding this comment

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

That was my initial suggestion :) I only started waffling because I realized I was unsure about best practices (regarding accessibility) for using headings within complex navigation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh right "heading element" got it. I did read it! I swear! I'll set it to the div for now as that's the safer of the two.

@Scotchester
Copy link
Contributor

Approved again :) Merge away!

@anselmbradford anselmbradford merged commit 6312eb0 into master Dec 12, 2017
@Scotchester Scotchester deleted the fix_a11y_issue branch December 14, 2017 22:54
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.

4 participants