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

Featured image control improvements and alt text #1116

Closed
afercia opened this issue Jun 10, 2017 · 6 comments · Fixed by #7200
Closed

Featured image control improvements and alt text #1116

afercia opened this issue Jun 10, 2017 · 6 comments · Fixed by #7200
Assignees
Labels
[Feature] Media Anything that impacts the experience of managing media [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).

Comments

@afercia
Copy link
Contributor

afercia commented Jun 10, 2017

The Featured image component could be improved a bit for accessibility. There are probably a few possible improvements:

  • the text "Click the image to edit or update"
  • keep or change the current Set/Remove button
  • the image alt text

screen shot 2017-06-10 at 17 31 18

Regarding the text "Click the image to edit or update", I'd totally be in favour of re-considering it, but please let me explain why it was added. The featured image, once set, gets wrapped in a link. However, there was just a title attribute to communicate the action associated to the link. Title attributes work just on hover and may be ignored by screen readers, depending on the screen reader and also on the user verbosity settings.

For this reason, in https://core.trac.wordpress.org/changeset/36000 the title attribute was replaced with some visible text. The text is associated to the link using aria-describedby so screen readers announce it automatically when the link is focused.

If the text "Click the image to edit or update" is going to stay, at the very least it should be associated to the link in the same way, using aria-describedby (and so there's the need of a unique ID). Worth noting it's possible to hide this text: screen readers should announce elements targeted with aria-describedby even when they're hidden.

However, I'm wondering if the whole control could be improved, also visually. The new media widgets just introduced a new pattern: the Image widget uses four controls: Add/Edit/Replace/Delete that make the available actions self-explanatory. Maybe worth exploring a new design to communicate (in an accessible way) the image is clickable and the associated action.

Regarding the alt text:
in core, the featured image in the admin UI currently uses the image alt text (if set), otherwise an empty alt text. In Gutenberg instead, the image uses an hardcoded alt text: alt="Featured image". As far as I see, the returned media object contains an alt_text property. It would be great to pair the current behaviour with the core one and even improve it a bit. The key here is that the authoring context is different from the front-end. While editing, users need to know what the image is, and that's communicated by the image alt attribute. I'd propose to consider something like:
In the admin UI:

  • if there's an alt_text, use that
  • otherwise, use as fallback something like "Featured image: no alt text provided"
    Instead, on the front-end the featured image should respect the author's intent and use the image alt text (if set) or an empty alt="".
@afercia afercia added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Jun 10, 2017
@afercia
Copy link
Contributor Author

afercia commented Jun 29, 2017

Re: this part, some design feedback would be greatly appreciated /cc @joen @melchoyce

I'm wondering if the whole control could be improved, also visually. The new media widgets just introduced a new pattern: the Image widget uses four controls: Add/Edit/Replace/Delete that make the available actions self-explanatory. Maybe worth exploring a new design to communicate (in an accessible way) the image is clickable and the associated action.

@mtias mtias added the Needs Design Feedback Needs general design feedback. label Nov 20, 2017
@mtias
Copy link
Member

mtias commented Nov 20, 2017

@jasmussen @karmatosed mind looking at this?

@jasmussen jasmussen self-assigned this Dec 4, 2017
jasmussen pushed a commit that referenced this issue Dec 6, 2017
This is an attempt to fix #1116.

It redesigns the Featured Image panel to more closely resemble both the visual style and the markup/accessibility of the Image widget.

One problem this PR has right now, is that I'm not quite sure how to update/tweak the labels, that appear to be using a `postLabel` function. As such when building this the labels were wrong. Any idea what this might be, @youknowriad
jasmussen pushed a commit that referenced this issue Dec 15, 2017
This is an attempt to fix #1116.

It redesigns the Featured Image panel to more closely resemble both the visual style and the markup/accessibility of the Image widget.

One problem this PR has right now, is that I'm not quite sure how to update/tweak the labels, that appear to be using a `postLabel` function. As such when building this the labels were wrong. Any idea what this might be, @youknowriad
@karmatosed karmatosed reopened this Mar 7, 2018
@karmatosed
Copy link
Member

karmatosed commented Mar 7, 2018

Will #2181 change this? Do we need to have this text by the featured image if we are showing once set in the post? @jasmussen I see some commits here, any of them close this or do we need to address still?

@jasmussen
Copy link
Contributor

Sorry I missed the ping.

#3829 was my attempt at fixing this issue, and I believe I reached a point in that branch that made the featured image dropzone accessible (so it could close this ticket).

However as it turns out, the upstream Media widgets that inspired this design in WordPress aren't as accessible as they should be. And then the question becomes — do we align with WordPress upstream so it's consistent, but not as accessible as it could be (see discussion in https://core.trac.wordpress.org/ticket/34323)? Or do we break consistency and make it accessible in Gutenberg so we can close this ticket?

At this point I'm too tired of opinions blocking other opinions, that I'll honestly do what I'm told to do on this one ;)

@karmatosed
Copy link
Member

@afercia do you have an opinion on this in light of what @jasmussen added? My own feelings are let's on this align with core - fixing there is totally something we'd fix in Gutenberg.

@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label May 20, 2018
@afercia
Copy link
Contributor Author

afercia commented May 21, 2018

@karmatosed @jasmussen thanks for the ping. Not sure there's consistency in core to align with 🙂 For example:

In the customizer:
the header image placeholder is not clickable, just text (same for the header video). Then, there's a button to add a media.

In the media widgets (both in the customizer and widgets screen):
they use a clickable div, and a button too; clickable divs are really something to avoid, hope there's consensus on this.

I see what Joen's tried in #3829 as a good improvement that should be implemented in core too. At least, the placeholder is now a button:

screen shot 2018-05-21 at 14 12 25

being a button, it can be used with any device / browser / assistive technology. That would solve the a11y concerns and also the usability concerns expressed by @melchoyce: users tend to click the placeholder because it looks like a clickable thing. Well, then let's make it a button, so everyone can use it.

Note: In the initial state, maybe the second button could go away.

Changing the label from No image selected to Set featured image as Joen did makes sense to me, as the new label implies there's no image selected yet.

Also, when the featured image is set it's within a button so it's an UI control usable by everyone:

screen shot 2018-05-21 at 14 31 01

The name of the control is given by alt="Featured image", that should be improved a bit and I'd say it's something we can iterate on later. Overall, I'd recommend to merge Joen's improvements and then align core's implementation with Gutenberg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
5 participants