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 speak message when a category gets added. #3915

Merged
merged 3 commits into from Dec 12, 2017

Conversation

Projects
None yet
2 participants
@afercia
Contributor

afercia commented Dec 11, 2017

This PR tries to improve the accessibility of the "Add Category" form. It adds a speak message when a category gets added.

Still to address: try to noop the button instead of disabling it.

Fixes #2634

@afercia afercia requested a review from youknowriad Dec 11, 2017

@afercia

This comment has been minimized.

Show comment
Hide comment
@afercia

afercia Dec 11, 2017

Contributor

Re: noop instead of disabling the button. If I'm not wrong, disabling the button is also not fully effective to avoid multiple submission because yes the button gets disabled but the form can still be submitted multiple times pressing Enter on the input field. So I guess the whole onSubmit should noop when adding a term.

Contributor

afercia commented Dec 11, 2017

Re: noop instead of disabling the button. If I'm not wrong, disabling the button is also not fully effective to avoid multiple submission because yes the button gets disabled but the form can still be submitted multiple times pressing Enter on the input field. So I guess the whole onSubmit should noop when adding a term.

@afercia

This comment has been minimized.

Show comment
Hide comment
@afercia

afercia Dec 11, 2017

Contributor

Last commit doesn't disable the submit button when adding a term, to avoid a focus loss. Instead, it returns early form submission processing. This should work also when submitting the form by pressing Enter in the form fields.

Contributor

afercia commented Dec 11, 2017

Last commit doesn't disable the submit button when adding a term, to avoid a focus loss. Instead, it returns early form submission processing. This should work also when submitting the form by pressing Enter in the form fields.

@aduth

aduth approved these changes Dec 11, 2017

Show outdated Hide outdated editor/components/post-taxonomies/hierarchical-term-selector.js Outdated
@@ -114,7 +114,9 @@ class HierarchicalTermSelector extends Component {
.then( ( term ) => {
const hasTerm = !! find( this.state.availableTerms, ( availableTerm ) => availableTerm.id === term.id );
const newAvailableTerms = hasTerm ? this.state.availableTerms : [ term, ...this.state.availableTerms ];
const { onUpdateTerms, restBase, terms } = this.props;
const { onUpdateTerms, restBase, terms, slug } = this.props;
const termAddedMessage = slug === 'category' ? __( 'Category added' ) : __( 'Term added' );

This comment has been minimized.

@aduth

aduth Dec 11, 2017

Member

Too bad there's not a taxonomy label for this so we didn't need to hard-code it 😕

https://developer.wordpress.org/reference/functions/get_taxonomy_labels/

@aduth

aduth Dec 11, 2017

Member

Too bad there's not a taxonomy label for this so we didn't need to hard-code it 😕

https://developer.wordpress.org/reference/functions/get_taxonomy_labels/

This comment has been minimized.

@afercia

afercia Dec 12, 2017

Contributor

Maybe we can open a Trac ticket for this 🙂

@afercia

afercia Dec 12, 2017

Contributor

Maybe we can open a Trac ticket for this 🙂

@afercia afercia merged commit 7aa9c25 into master Dec 12, 2017

3 checks passed

codecov/project 38.51% (+0.29%) compared to 0fb7c43
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@afercia afercia deleted the update/add-category-a11y-improvements branch Dec 12, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment