diff --git a/CHANGELOG.md b/CHANGELOG.md index 762f7a6..260b134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,26 @@ Format: [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/) — versi ## [Unreleased] +### Fixed — Empty-state notice ("No notes found") now dismissible +The "No active notes found" / "No completed notes found" inline +notice on the My Notes page rendered with `class="notice notice-info"` +but no `is-dismissible` modifier, so WordPress's core common.js +never attached an X close button to it. Users couldn't clear the +message for the current view. Adding `is-dismissible` is the only +change — WP core handles the X button render + click-to-hide +automatically. Dismissal is per-page-load (the message reappears on +next refresh if the list is still empty); persistence across +reloads would need user_meta tracking and isn't built yet. + +**Notice inventory after this fix** — every notice the plugin emits +is now both dismissible AND only fires in its intended state: + +| Notice | Class | Fires when | +|---|---|---| +| "No active/completed notes found" | `notice notice-info is-dismissible` | List is empty | +| Migration prompt | `notice notice-info is-dismissible` | `wp_notes_migration_completed` option is unset | +| Settings save / import errors / import success | rendered by core `settings_errors()` (auto-dismissible since WP 4.2) | Only on form submission events | + ### Changed — Removed duplicate smiley-face button on the emoji picker The "Add emoji" formatting option rendered two clickable elements stacked: the *"Click to add emoji"* text input AND a separate button diff --git a/inc/wp-notes-display.php b/inc/wp-notes-display.php index 6b0cb65..06ea23f 100644 --- a/inc/wp-notes-display.php +++ b/inc/wp-notes-display.php @@ -22,7 +22,12 @@ function wp_notes_display_notes($type = 'active') { $section_title = ($type === 'active') ? 'Active Notes' : 'Completed Notes'; if (empty($notes)) { - echo '
'; + /* is-dismissible adds an X button via WP core's common.js so + users can clear the empty-state message for the current view. + Dismissal is per-page-load (the message reappears on next + refresh if the list is still empty) — persistence across + reloads would need user_meta tracking and isn't built yet. */ + echo '
'; echo '

' . esc_html__('No ' . ($type === 'active' ? 'active' : 'completed') . ' notes found.', 'a-wp-notes') . '

'; echo '
'; return;