Skip to content

Commit

Permalink
speak when item gets moved
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Nov 12, 2024
1 parent 00625fb commit 8022000
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions assets/js/todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,14 @@ progressPlannerDomReady( () => {
const todoItem = jQuery( this ).closest( 'li' );
todoItem.insertBefore( todoItem.prev( 'li' ) );
progressPlannerSaveTodoList();
wp.a11y.speak( progressPlannerTodo.i18n.taskMovedUp );
} );

// When the move down button is clicked, move the todo item down the list
jQuery( '#todo-list' ).on( 'click', '.move-down', function () {
const todoItem = jQuery( this ).closest( 'li' );
todoItem.insertAfter( todoItem.next( 'li' ) );
progressPlannerSaveTodoList();
wp.a11y.speak( progressPlannerTodo.i18n.taskMovedDown );
} );
} );
4 changes: 3 additions & 1 deletion classes/admin/class-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function register_scripts() {
\wp_register_script(
'progress-planner-todo',
PROGRESS_PLANNER_URL . '/assets/js/todo.js',
[ 'jquery-ui-sortable', 'progress-planner-ajax', 'wp-util', 'progress-planner-grid-masonry' ],
[ 'jquery-ui-sortable', 'progress-planner-ajax', 'wp-util', 'progress-planner-grid-masonry', 'wp-a11y' ],
filemtime( PROGRESS_PLANNER_DIR . '/assets/js/todo.js' ),
true
);
Expand Down Expand Up @@ -236,6 +236,8 @@ public function register_scripts() {
'taskMoveUp' => \esc_html__( "Move task '%s' up", 'progress-planner' ),
/* translators: %s: The task content. */
'taskMoveDown' => \esc_html__( "Move task '%s' down", 'progress-planner' ),
'taskMovedUp' => \esc_html__( 'Task moved up', 'progress-planner' ),
'taskMovedDown' => \esc_html__( 'Task moved down', 'progress-planner' ),
/* translators: %s: The task content. */
'taskCompleted' => \esc_html__( "Task '%s' completed and moved to the bottom", 'progress-planner' ),
/* translators: %s: The task content. */
Expand Down

0 comments on commit 8022000

Please sign in to comment.