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 missing label and focus style to the code editor textarea #6262

Merged
merged 3 commits into from
Apr 20, 2018

Conversation

afercia
Copy link
Contributor

@afercia afercia commented Apr 18, 2018

This PR adds a <label> element to the "Code editor" mode textarea using the same pattern used for the post title. Worth noting this pattern matches the visible placeholder text with the visually hidden label to ensure it works for all users and all assistive technology but it's basically a hack and should be avoided as much as possible. Visible labels are always preferable (and a WCAG requirement) for the reasons explained in #6199 and #6206 (comment)

Also adds a filter, in the same way a filter is used for the post title.

Adds a focus (and hover) style to the content textarea to match the same effects used on the post title (see the code editor polish and focus style #1837 / #4803). The outline-offset property won't work in IE11 that just means on hover and focus the outline will appear externally to the box. I guess we can live with that.

It also adds a small bottom margin to the content textarea, because currently, with long content, the textarea touches the viewport bottom edge. I guess avoiding that is a better option.

To test:

  • create a new post
  • using a screen reader, focus the content and verify the label is announced correctly
  • verify the CSS effects on hover and focus
  • try to use the filter to change the label and placeholder

Fixes #6260

Screenshots (normal and hover/focus):

screen shot 2018-04-18 at 23 13 54

screen shot 2018-04-18 at 23 14 00

@afercia afercia added the [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). label Apr 18, 2018
@jasmussen
Copy link
Contributor

text

Seems to work as advertised, and looks good to me, 👍 👍

Is "Add content" the best we can do? It works for me, and I'm aware that "Write your story" isn't setting hearts on fire. But do we want to consider those two phrases in the same light, or should they be different?

@afercia
Copy link
Contributor Author

afercia commented Apr 19, 2018

Is "Add content" the best we can do?

Open to any suggestions, just let me know.

@karmatosed
Copy link
Member

karmatosed commented Apr 19, 2018

Text wise lets not have 'add content' as an instruction, we need to be a lot more guiding than that. I think what we had before worked far better for that reason. Is there a need to change the copy? If so, what are the parameters for that change?

Copy link
Member

@karmatosed karmatosed left a comment

Choose a reason for hiding this comment

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

Changes outlined above, lets fix before we merge this.

@afercia
Copy link
Contributor Author

afercia commented Apr 19, 2018

what we had before worked far better for that reason. Is there a need to change the copy

@karmatosed there was no copy before. Right now the textarea has no label an no placeholder.

@karmatosed
Copy link
Member

@afercia ah sorry I got myself all confused, apologies. Can't we just have "Write your story, edit text?" for cohesiveness first?

@afercia
Copy link
Contributor Author

afercia commented Apr 20, 2018

Sure, going to change it in Write your story for consistency. Not so great for Custom Post Types (e.g products, testimonials, etc.) but it can be filtered and changed by plugins so 👍

@jasmussen
Copy link
Contributor

Cool — I do think we have a separate ticket to revisit the phrasing "Write your story", but do feel like it would be good to have consistency here. Then we can replace both if/when we decide new phrasing.

@afercia
Copy link
Contributor Author

afercia commented Apr 20, 2018

Done:

New post in the visual editor:

screen shot 2018-04-20 at 09 14 02

New post in the code editor:

screen shot 2018-04-20 at 09 14 07

@afercia afercia dismissed karmatosed’s stale review April 20, 2018 07:29

Feedback addressed

@afercia afercia merged commit 3b8f242 into master Apr 20, 2018
@afercia afercia deleted the update/code-editor-textarea-label branch April 20, 2018 07:29
nuzzio pushed a commit to nuzzio/gutenberg that referenced this pull request Apr 25, 2018
…ess#6262)

* Add label, placeholder, and filter to the content textarea.

* Add focus style to the content textarea.

* Use Write your story.
@mtias mtias added this to the 2.8 milestone May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants