Mojira Archive
MCM-1776

@minecraft/server-ui does not correctly respect the formatting reset character (§r)

Verification Builds:
UWP 1.20.80 24038308

Regression Builds:
Since forever?

Summary:
The @minecraft/server-ui fails to properly handle the formatting reset character (§r). Normally, the default button text color is gray. When the mouse is hovered over a button, the background changes to green and the text switches to white. Using the reset character (§r), however, results in the text appearing black regardless of the mouse hover state. This issue not only affects visual consistency but could also pose accessibility challenges.

Affects currently Live Content:
Yes

Impact:
This issue not only affects visual consistency but could also pose accessibility challenges.

Repro Steps:

The following code creates a simple UI.

const form = new ActionFormData();
form.button("Boss Level\nProceed with caution!");
form.button("§lBoss Level§r\nProceed with caution!");
form.button("§c§lBoss Level§r\nProceed with caution!");
form.show(eventData.sourceEntity as Player);

Observed Results:

Please see video

1. The first button without formatting correctly changes to white text on hover, and is gray by default.
2. The second button incorrectly has black text on the second line. Since we used §r, one would expect the formatting to be cleared back to the default gray (as seen in button 1). It also does not change to white on hover.
3. Same result as 2.

Expected Results:

  • The §r character should clear the text formatting, meaning the text should become gray, and should become white text on hover.
  • It also feels a bit weird that colored text doesn't change to white, too - which can create some accessibility/legibility issues (for example, if the text is green, it would be very hard to see against the green button background).

Screenshots/Videos attached: Yes - https://capture.dropbox.com/Wv5eYNpmWR58ttFx

Notes: 

1. This is also an issue when using RawMessage.

2. Forcing the text color to gray (instead of §r) as a workaround is problematic as it is hard to read the gray text against the green button background on hover.

Unresolved

57Digital

2024-05-02, 11:04 PM

2024-05-03, 12:29 AM

2

0

Future Release

-