Make WordPress Core

Opened 10 years ago

Last modified 2 days ago

#37280 assigned enhancement

Remove boldness from update notices

Reported by: ocean90 Owned by: Presskopp
Priority: normal Milestone: Future Release
Component: General Version:
Severity: normal Keywords: good-first-bug has-patch has-screenshots
Cc: Focuses: ui, administration

Description

Previously: ​https://wordpress.slack.com/archives/design/p1466093104000007

The notices are currently inconsistent, some are bold, some are not, and some use bold only to highlight words.

OH: Bold text is just wasted bandwidth.

Attachments (21)

edit-posts.png​ (21.8 KB ) - added by ocean90 10 years ago.
menus.png​ (41.5 KB ) - added by ocean90 10 years ago.
plugins.png​ (17.4 KB ) - added by ocean90 10 years ago.
posts-trashed.png​ (21.1 KB ) - added by ocean90 10 years ago.
profile.png​ (25.3 KB ) - added by ocean90 10 years ago.
settings.png​ (22.5 KB ) - added by ocean90 10 years ago.
theme-activated.png​ (25.8 KB ) - added by ocean90 10 years ago.
theme-editor.png​ (25.3 KB ) - added by ocean90 10 years ago.
permalinks.png​ (44.7 KB ) - added by ocean90 10 years ago.
37280.1.diff​ (3.8 KB ) - added by Presskopp 10 years ago.
First patch
37280.template.diff​ (1.4 KB ) - added by Presskopp 10 years ago.
37280.2.diff​ (5.0 KB ) - added by jpolakovic 10 years ago.
37280.diff​ (4.2 KB ) - added by Presskopp 7 years ago.
37280.3.diff​ (2.5 KB ) - added by Presskopp 6 years ago.
37280.4.diff​ (2.5 KB ) - added by Presskopp 6 years ago.
before-settings-saved.png​ (13.8 KB ) - added by mayankmajeji 2 days ago.
Before: "Settings saved." is bold (Settings > Reading, 7.2-beta4-65325)
after-settings-saved.png​ (13.7 KB ) - added by mayankmajeji 2 days ago.
After: "Settings saved." is plain text, with the patch from PR 15773
before-profile-updated.png​ (9.2 KB ) - added by mayankmajeji 2 days ago.
Before: "Profile updated." is bold
after-profile-updated.png​ (9.1 KB ) - added by mayankmajeji 2 days ago.
After: "Profile updated." is plain text
before-menu-updated.png​ (15.9 KB ) - added by mayankmajeji 2 days ago.
Before: only the menu name is bold in "%s has been updated." (Twenty Twenty-One)
after-menu-updated.png​ (15.8 KB ) - added by mayankmajeji 2 days ago.
After: "%s has been updated." is plain text

Download all attachments as: .zip

Change History (37)

#1 follow-up: @Presskopp
10 years ago

  • Keywords has-patch added; needs-patch removed

Patch. Hope I detected them all.

@ocean90

Two questions

1) OH === Oral Hygiene ?
2) Where did you find this chubby "Permalink structure updated"? Is it

\wp-admin\edit-tag-form.php, L.75

or did I just destroy something?

This ticket was mentioned in ​Slack in #core by elrae. ​View the logs.


10 years ago

This ticket was mentioned in ​Slack in #polyglots by presskopp. ​View the logs.


10 years ago

#4 in reply to: ↑ 1 @ocean90
10 years ago

  • Owner set to Presskopp
  • Status new → assigned

Replying to Presskopp:

2) Where did you find this chubby "Permalink structure updated"?

It's passed to add_settings_error() and printed by settings_errors().

#5 follow-up: @Presskopp
10 years ago

Ok, if I'm not mistaking, that makes it a patch. But wait! Is there any good in this:

printf(__('Comment by %s moved to the trash.'), '<strong></strong>');
printf(__('Comment by %s marked as spam.'), '<strong></strong>');

found in

\wp-admin\includes\template.php, L.465/468

So what about

printf(__('Comment by %s moved to the trash.'));
printf(__('Comment by %s marked as spam.'));

#6 @Presskopp
10 years ago

comments please, this is adding some more lines as a separate patch

#7 in reply to: ↑ 5 @dd32
10 years ago

Replying to Presskopp:

Ok, if I'm not mistaking, that makes it a patch. But wait! Is there any good in this:

printf(__('Comment by %s moved to the trash.'), '<strong></strong>');
printf(__('Comment by %s marked as spam.'), '<strong></strong>');

If you look at how it's actually used in the UI, the JS fills the <strong> tags in with the commenter's name.
Javascript doesn't understand %s as a placeholder, so HTML tags are used instead. If we want to remove the bolding of the username here we'd need to replace it with something such as <span></span> and update whatever JS uses it to search for the span tag rather than strong.

#8 @Presskopp
10 years ago

thanks @dd32

If we want to keep it simple (not changing tags for JS), all I see left now would be this line:

$output .= "<p><strong>{$details['message']}</strong></p>"; in template.php L.1480

I must not be the one doing the final patch, as always just trying to contribute.

#9 @jpolakovic
10 years ago

@dd32 I have created a patch that cnosolidates all the code @Presskopp contributed so far, plus I'm adding a simple fix for removing the boldness from the author fields that are populated by the JavaScript in edit-comments.js.

Using jQuery's .replaceWith instead of .text on L283 of edit-comments.js replaces the <strong></strong> placeholder by a text string containing the author name.

Version 0, edited 10 years ago by jpolakovic (next)

#10 @desrosj
8 years ago

  • Focuses administration added
  • Keywords needs-refresh added

@jpolakovic are you able to refresh this patch? It no longer applies cleanly to trunk.

Spot checking these instances, it appears that there are still inconsistencies. Though, these should be audited as it's possible some have been fixed elsewhere.

#11 @Presskopp
7 years ago

kind of refreshed patch

#12 @grzim
6 years ago

@Presskopp it seems like the patch you added has a merge conflict in the file:
wp-admin/options.php.

Can you please resolve it?

#13 @Presskopp
6 years ago

Sorry hit the button twice, the both .3 and .4 are the same.

Went through this again and this is what I found. Not sure if I got them all, especially when it comes to .js files.

This ticket was mentioned in ​PR #15773 on ​WordPress/wordpress-develop by ​@mayankmajeji.


2 days ago
#15

  • Keywords needs-refresh removed

Removes the <strong> wrapper from admin notices where the whole message is bold, so they match notices like "Plugin activated." that are already plain text.

This refreshes the earlier patches on the ticket (props Presskopp and jpolakovic on Trac) against current trunk. Since those patches, most of these notices moved to wp_admin_notice(), so none of the old patches apply.

Changes:

  • settings_errors() no longer wraps every message in <strong>. This is the "Settings saved." notice on every Settings screen.
  • "Profile updated." and "User updated." in user-edit.php
  • The term update notice in edit-tag-form.php (for example "Category updated.")
  • "Administration email updated." in options-general.php
  • "Settings saved." and "Network admin email updated." in network/settings.php
  • "Settings saved." in my-sites.php
  • The menu name in "%s has been updated." in wp_nav_menu_update_menu_items()

Bold labels that introduce a message ("Error:", "Warning:", "Caution:", "For more information:") are left as they are.

Testing

Tested on WordPress 7.2-beta4-65325 (nightly), PHP 8.2.27, nginx 1.26.1, MySQL 8.0.35, Chrome on macOS. For each notice, I checked the notice markup and its computed font-weight before and after the patch:

Notice Before After
Settings saved. (Settings > Reading) <strong>, 600 plain, 400
Administration email updated. <strong>, 600 plain, 400
Profile updated. <strong>, 600 plain, 400
Category updated. <strong>, 600 plain, 400
Test Menu has been updated. (Twenty Twenty-One) menu name <strong>, 600 plain, 400

Not tested by hand: "User updated." (same pattern as "Profile updated." in the same file) and the three multisite notices.

Screenshots are attached to the Trac ticket.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Searching trunk for bolded notices, drafting the change, and running the before/after checks on my local install. I reviewed every line of the diff and the test results, and edited this description.

---
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See ​GitHub Pull Requests for Code Review in the Core Handbook for more details.

🤖 Generated with ​Claude Code

@mayankmajeji
2 days ago

Before: "Settings saved." is bold (Settings > Reading, 7.2-beta4-65325)

@mayankmajeji
2 days ago

After: "Settings saved." is plain text, with the patch from PR 15773

@mayankmajeji
2 days ago

Before: "Profile updated." is bold

@mayankmajeji
2 days ago

After: "Profile updated." is plain text

@mayankmajeji
2 days ago

Before: only the menu name is bold in "%s has been updated." (Twenty Twenty-One)

@mayankmajeji
2 days ago

After: "%s has been updated." is plain text

#16 @mayankmajeji
2 days ago

  • Keywords has-screenshots added

Hi @Presskopp, I hope you don't mind me picking this up again. I've refreshed the patch against trunk in the linked PR, with props to you and @jpolakovic for the earlier work.

None of the earlier patches apply any more because most of these notices moved to wp_admin_notice(). While checking trunk, I found one spot the earlier patches didn't cover: settings_errors() wraps every message in <strong>. That is where the bold "Settings saved." on every Settings screen comes from. If it stays bold, the other notices end up less consistent rather than more, so I've included it.

Not tested by hand: "User updated." (same pattern as "Profile updated." in the same file) and the three multisite notices (My Sites, Network Settings, Network admin email).

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Searching trunk for bolded notices, drafting the change, and running the before/after checks on my local install. I reviewed every line of the diff and the test results, and edited this comment.

I kept bold labels that introduce a message ("Error:", "Warning:", "Caution:", "For more information:") as they are, since the bold has a job there.

Two things I'd like a second opinion on:

  1. settings_errors() is used by plugins through the Settings API, so their notices will also stop being bold. Error messages shown through it lose the bold as well. Plugins that wrap part of their own message in <strong> keep that.
  2. "%s has been updated." on the Menus screen bolded only the menu name. That's the "bold only to highlight words" case from the description. I removed it for consistency, but it's easy to put back if the name should stay highlighted.

Test Report

Patch tested: ​https://github.com/WordPress/wordpress-develop/pull/15773

Environment

  • WordPress: 7.2-beta4-65325 (nightly)
  • PHP: 8.2.27
  • Server: nginx/1.26.1
  • Database: MySQL 8.0.35
  • Browser: Chrome on macOS
  • Themes: Twenty Twenty-Five, and Twenty Twenty-One for the Menus screen

Results

For each notice, I checked the notice markup and its computed font-weight before and after the patch:

  • Settings saved. (Settings > Reading): bold (600) before, plain (400) after
  • Administration email updated.: bold before, plain after
  • Profile updated.: bold before, plain after
  • Category updated.: bold before, plain after
  • "Test Menu has been updated.": menu name bold before, plain after
  • "Plugin activated." (not changed, for comparison): plain before and after

Before/after screenshots for Settings saved, Profile updated and the menu notice are attached.

Last edited 2 days ago by mayankmajeji (previous) (diff)
Note: See TracTickets for help on using tickets.