#28861 closed enhancement (duplicate)
No easy way to get alt text of custom header image
Reported by: | henry.wright | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4 |
Component: | Themes | Keywords: | |
Focuses: | accessibility | Cc: |
Description (last modified by )
get_custom_header()->width;
and get_custom_header()->height;
can be used to get the width and height of the custom header image but there seems to be no easy way to get the image's alt text.
The alt text is needed in cases where the custom header image is used to convey semantic content.
Change History (7)
#5
@
10 years ago
- Resolution set to duplicate
- Status changed from new to closed
This maybe a duplicate of ticket #15926: Add alt attribute support for Custom Header functionality.
Adding an alt="" if there is no alt given is, to my opinion, not a good idea, since the header image is in some themes also the link to the home page.
How to add a meaningful alt attribute is discussed in ticket #15926. And using the _wp_attachment_image_alt is a good one to add to the discussion.
#6
@
10 years ago
Strongly agree that adding an alt="" is a bad idea; my understanding is that with some screen readers, focus is lost if the alt atribute is empty. "If" people are relying on it to navigate home, then that is a problem.
What I don't know: If the header is wrapped in an <a> element, does the link function over-ride, or get over-ridden, by the the empty alt attribute?
For more background, see this:
".... The reason to use an empty ‘alt’ attribute is that this is a signal to the screen reader to skip over the image. When a screen reader comes across an image with an empty ‘alt’ attribute, it ignores the image: it’s as if the image was never there in the first place.."
If it's any use, this is the function I'm using (adapted from here).