Make WordPress Core

Opened 5 years ago

Closed 9 days ago

#50402 closed defect (bug) (fixed)

Admin notices: error messages should not be all bold

Reported by: afercia's profile afercia Owned by: joedolson's profile joedolson
Milestone: 6.8 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch commit has-screenshots
Focuses: ui Cc:

Description (last modified by sabernhardt)

Splitting this out from #47656.

While there are cases where the admin notices error messages may legitimately use bold form some terms within the message, the whole message shouldn't be bold.

The vast majority of the error admin notices are just text with a normal font weight. The <strong> element does add semantic (strong) emphasis but that's an addition that brings in very little value. Visually: the bold message is inconsistent with most of the error admin notices.

Some examples:

echo '<div class="error"><p><strong>' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>';

and

echo '<div class="error"><p><strong>' . __( 'The network could not be created.' ) . '</strong></p>';

These "all bold" admin notices should be adjusted to remove the all-bold effect.

Worth also reminding the CSS class class="error" is legacy and should be replaced with class="notice notice-error".

Attachments (2)

network-broken-before.png (38.5 KB) - added by joedolson 9 days ago.
Network theme broken - before
network-broken-after.png (36.4 KB) - added by joedolson 9 days ago.
Network theme broken - after

Download all attachments as: .zip

Change History (36)

#1 @ocean90
5 years ago

Related: #37280

This ticket was mentioned in Slack in #design by afercia. View the logs.


5 years ago

#3 @joedolson
17 months ago

  • Milestone changed from Awaiting Review to 6.5
  • Owner set to joedolson
  • Status changed from new to accepted

This ticket was mentioned in PR #5651 on WordPress/wordpress-develop by @rajinsharwar.


17 months ago
#4

  • Keywords has-patch added

Adding Bold only on the "Error:" text.

Trac ticket: https://core.trac.wordpress.org/ticket/50402

#5 @rajinsharwar
17 months ago

As for the current trunk, I found two instances of such inconsistency. I tried to review each instance of the Error: text and make them under the STRONG, and the remaining notice message as normal text. Let me know if any other instance where this was missed.

This ticket was mentioned in PR #5844 on WordPress/wordpress-develop by expedition-robin-martijn.


15 months ago
#6

As described in the Trac ticket below, class="error" is legacy and should be replaced with class="notice notice-error". In this PR, I have done that.

Trac ticket: https://core.trac.wordpress.org/ticket/50402

#7 @robinmartijn
15 months ago

I have updated the error classes as described in the ticket above. First time contributing, so please don't hesitate to let me know if and how I screwed up. ;-)

#8 @mukesh27
15 months ago

In #57791, we introduced admin notice functions. Could we integrate those functions into the PHP code instead of having the notice code inline?

#9 @joedolson
14 months ago

Thanks for your patches @robinmartijn and @rajinsharwar

As @mukesh27 says, we'll need to integrate the new classes into the function calls in most cases. These will also require visual inspection and screenshots to verify that any changes are acceptable.

In the wp_admin_notice() function, the classes 'notice notice-error' are automatically added by setting the type to 'error', and should be omitted from the paragraph wrapper. If there's a different class on the paragraph inside the error, those are different from the notice classes and should be retained - in most cases, they're likely needed hooks for some JS event or response.

#10 @swissspidy
13 months ago

@joedolson Is this on your radar for 6.5? It looks like a punt candidate to me.

#11 @swissspidy
13 months ago

  • Milestone changed from 6.5 to 6.6

This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.


10 months ago

This ticket was mentioned in Slack in #accessibility by rcreators. View the logs.


9 months ago

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


9 months ago

#15 @oglekler
9 months ago

  • Keywords changes-requested added

It looks like this patch needs new patch and possibly has some dependency from another ticket about errors notifications 🤔

#16 @sabernhardt
9 months ago

  • Description modified (diff)
  • Milestone changed from 6.6 to 6.7

The dependency mentioned earlier was the wp_admin_notice() function, which is included in recent versions.

PR 5844 is closed, but I do not recommend editing the (classes for) upgrade notices in bundled themes. Those error messages only appear when trying to activate the theme in an older version of WordPress.

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


7 months ago

#18 @chaion07
7 months ago

Thanks @afercia for reporting this. We reviewed this Ticket during a recent Core Triage session. Based on the feedback received we feel the need for a specific discussion in order to move this Ticket forwards and closer to a resolution. Lets continue the discussion in the comments.

Props to @cbravobernal for the suggestion

Cheers!

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


6 months ago

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


6 months ago

#21 @stoyangeorgiev
6 months ago

  • Milestone changed from 6.7 to Future Release

This one was discussed at a few bug-scrubs and with 6.7 right around the corner, I think we can move this one for a Future-Release. It could be easily set to 6.8 at a later time.

#22 @joedolson
6 months ago

  • Milestone changed from Future Release to 6.8

This ticket was mentioned in PR #7800 on WordPress/wordpress-develop by @im3dabasia1.


4 months ago
#23

Trac ticket: https://core.trac.wordpress.org/ticket/50402

This PR addresses by updating admin error notices to use the notice notice-error classes instead of the legacy error class. This change aligns error notice styling with current WordPress standards and improves visual consistency across the admin interface.

#24 @im3dabasia1
4 months ago

Hi @afercia,

I've raised a PR for this issue. Please let me know if there are any changes needed, and thank you for your guidance and feedback!

Thanks again!

#25 @audrasjb
7 weeks ago

  • Keywords changes-requested removed

Thanks @im3dabasia1, I tested some instances of the error message affected by your PR and it looks good to me.

#26 @joedolson
7 weeks ago

  • Keywords changes-requested added

There are still some changes needed here; @sabernhardt's comments haven't been addressed, and there are a few other classes that are changed in the PR that shouldn't be, particulary in wp-signup.php, which doesn't load admin styles.

@im3dabasia1 commented on PR #7800:


7 weeks ago
#27

@joedolson , I have removed the changes related to the back-compat files.

Please let me know if you have any further feedback or suggestions for improvements.

@joedolson commented on PR #7800:


7 weeks ago
#28

Thanks, @im3dabasia!

Still need to update the error classes used in wp-signup.php, per my comments on that file.

This ticket was mentioned in PR #8402 on WordPress/wordpress-develop by @dkarfa.


3 weeks ago
#29

# Remove unnecessary <strong> tags from admin error notices

## Description

This PR addresses the inconsistent use of bold formatting in admin error notices. Currently, many error messages are wrapped entirely in <strong> tags, making the whole message bold. This PR aims to remove these unnecessary <strong> tags, improving readability and consistency with other admin notices.

## Changes proposed in this Pull Request:

  • Remove <strong> tags that wrap entire error messages
  • Retain bold formatting only for specific terms that require emphasis within messages
  • Update the legacy CSS class error to the more modern notice notice-error

Trac ticket: Trac ticket: https://core.trac.wordpress.org/ticket/50402

#30 @najmulsaju
2 weeks ago

The use of <strong> tags around entire error messages creates inconsistency and harms readability. The proposed fix to remove these tags and only use bold for emphasized terms makes the notices more consistent and visually aligned with WordPress standards. Replacing the legacy class="error" with class="notice notice-error" is also a necessary update to modernize the error notices. This change improves both the UI and accessibility.

@shailu25 commented on PR #7800:


2 weeks ago
#31

@im3dabasia Whenever you get a chance, Could you Please Resolve Conflicts and Rebase this PR with Latest trunk?

#32 @joedolson
9 days ago

  • Keywords commit added; changes-requested removed

I think this one is ready. I can't guarantee that it covers all errors that are currently completely bold (negative evidence is not proof), but it's an improvement.

I tested all scenarios and reverted the ones that were inappropriate, and made a few changes. The only really significant visual change is in the broken theme list table in the multisite network admin. Screenshots incoming.

@joedolson
9 days ago

Network theme broken - before

@joedolson
9 days ago

Network theme broken - after

#33 @joedolson
9 days ago

  • Keywords has-screenshots added

#34 @joedolson
9 days ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 59960:

Administration: Update out of date error message styling.

Change several error message across core to use WordPress standard styling. Ensure only prefixes are wrapped in strong tags rather than the whole message, use notice notice-error classes where appropriate, and replace a custom error with wp_admin_notice() in multisite.

Props afercia, rajinsharwar, robinmartijn, mukesh27, sabernhardt, oglekler, joedolson, chaion07, im3dabasia1, audrasjb, dkarfa, najmulsaju.
Fixes #50402.

Note: See TracTickets for help on using tickets.