Sample permalink: Improve accessibility of changing the permalink on Edit Post screen.

Props afercia.
Fixes #34255.
Built from https://develop.svn.wordpress.org/trunk@35229


git-svn-id: http://core.svn.wordpress.org/trunk@35195 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2015-10-16 23:02:25 +00:00
parent ac630ba233
commit f98136c1b5
9 changed files with 30 additions and 24 deletions

View File

@ -104,7 +104,10 @@ input#link_url {
#edit-slug-box .cancel {
margin-left: 10px;
padding: 0;
font-size: 11px;
text-decoration: underline;
color: #0073aa;
}
#comment-link-box {

View File

@ -104,7 +104,10 @@ input#link_url {
#edit-slug-box .cancel {
margin-right: 10px;
padding: 0;
font-size: 11px;
text-decoration: underline;
color: #0073aa;
}
#comment-link-box {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1346,7 +1346,7 @@ function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {
$return = '<strong>' . __( 'Permalink:' ) . "</strong>\n";
$return .= '<span id="sample-permalink"><a href="' . esc_url( $view_link ) . '"' . $preview_target . '>' . $display_link . "</a></span>\n";
$return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.
$return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js">' . __( 'Edit' ) . "</button></span>\n";
$return .= '<span id="edit-slug-buttons"><button type="button" class="edit-slug button button-small hide-if-no-js" aria-label="' . __( 'Edit permalink' ) . '">' . __( 'Edit' ) . "</button></span>\n";
$return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";
}

View File

@ -741,10 +741,10 @@ jQuery(document).ready( function($) {
$el = $( '#editable-post-name' );
revert_e = $el.html();
buttons.html('<button type="button" class="save button button-small">'+postL10n.ok+'</button> <a class="cancel" href="#">'+postL10n.cancel+'</a>');
buttons.children('.save').click( function( e ) {
buttons.html( '<button type="button" class="save button button-small">' + postL10n.ok + '</button> <button type="button" class="cancel button-link">' + postL10n.cancel + '</button>' );
buttons.children( '.save' ).click( function() {
var new_slug = $el.children( 'input' ).val();
e.preventDefault();
if ( new_slug == $('#editable-post-name-full').text() ) {
buttons.children('.cancel').click();
return;
@ -768,11 +768,11 @@ jQuery(document).ready( function($) {
permalink.html(permalinkOrig);
real_slug.val(new_slug);
$( '.edit-slug' ).focus();
wp.a11y.speak( postL10n.permalinkSaved );
});
});
buttons.children('.cancel').click( function( e ) {
e.preventDefault();
buttons.children( '.cancel' ).click( function() {
$('#view-post-btn').show();
$el.html(revert_e);
buttons.html(buttonsOrig);
@ -787,23 +787,22 @@ jQuery(document).ready( function($) {
}
slug_value = ( c > full.length / 4 ) ? '' : full;
$el.html( '<input type="text" id="new-post-slug" value="'+slug_value+'" autocomplete="off" />').children('input').keypress(function(e) {
var key = e.keyCode || 0;
// on enter, just save the new slug, don't save the post
if ( 13 == key ) {
$el.html( '<input type="text" id="new-post-slug" value="' + slug_value + '" autocomplete="off" />' ).children( 'input' ).keydown( function( e ) {
var key = e.which;
// On enter, just save the new slug, don't save the post.
if ( 13 === key ) {
e.preventDefault();
buttons.children( '.save' ).click();
return false;
}
if ( 27 == key ) {
if ( 27 === key ) {
buttons.children( '.cancel' ).click();
return false;
}
} ).keyup( function() {
real_slug.val( this.value );
}).focus();
}
$('#edit-slug-box').on( 'click', '.edit-slug', function() {
$( '#titlediv' ).on( 'click', '.edit-slug', function() {
editPermalink();
});

File diff suppressed because one or more lines are too long

View File

@ -500,7 +500,7 @@ function wp_default_scripts( &$scripts ) {
'tagDelimiter' => _x( ',', 'tag delimiter' ),
) );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count' ), false, 1 );
$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
'ok' => __('OK'),
'cancel' => __('Cancel'),
@ -524,6 +524,7 @@ function wp_default_scripts( &$scripts ) {
'published' => __('Published'),
'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
'savingText' => __('Saving Draft&#8230;'),
'permalinkSaved' => __( 'Permalink saved' ),
) );
$scripts->add( 'press-this', "/wp-admin/js/press-this$suffix.js", array( 'jquery', 'tags-box' ), false, 1 );

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-35228';
$wp_version = '4.4-alpha-35229';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.