playdate.menuItem:getTitle() returns lowercase version of original title

Repro

  1. playdate.menuItem:setTitle("Test Title")
  2. playdate.menuItem:getTitle()

Expected

  • “Test Title”

Actual

  • “test title”

Workarounds

  1. always set title as lower case text
  2. make sure to test title against lowercase text

filed! looks like a simple bug, famous last words

2 Likes

Okay, finally fixed this. Took this long to make up our minds about what the correct behavior is here. (And I'm still not 100% convinced, but more than 50%)

1 Like

If it helps your thinking on this, when I saw the changelog note for this in 1.10.0 I thought "ahh yes this new behavior makes more sense". I think of the title -> lowercase behavior of the menu to be akin to applying a text-transform: lowercase in CSS. It's style/display only, the underlying data doesn't change. When I tried the menus out in pre-1.10.0 I was surprised to see the title value come back different from what I set originally.

What finally pushed me to do it is Greg commenting that we might (very unlikely, but still..) change the way the text is drawn in the future, but we'd still have to keep the lower-cased getTitle() for compatibility. And then it would be really weird for it to not match either the text you gave it or what's being shown.

2 Likes

Good Greg! He knows best