Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bangle.js1 - "< Back" duplicates #2470

Open
Erovia opened this issue Feb 26, 2024 · 2 comments
Open

Bangle.js1 - "< Back" duplicates #2470

Erovia opened this issue Feb 26, 2024 · 2 comments

Comments

@Erovia
Copy link

Erovia commented Feb 26, 2024

According to the Graphical Menu documentation, each menu can have a "back" key in the "" section.
My understanding is that this could/should be preferred over explicitly creating menu options for moving between menus.

However, on the Bangle.js 1 this only works as intended when the user opens the submenu for the first time.
On the second (and following) entries there will be two < Back options in the menu.
One at the top, one at the bottom.
menu_bug

This is because after entering the menu for the first time, a "< Back" key is created in the menu object, outside of "".

Repro

  1. Execute test code on the Bangle.js 1 emulator:
var mainmenu = {
  "" : {
    "title" : "-- Main Menu --"
  },
  "Submenu" : function() { E.showMenu(submenu); },
};

var submenu = {
  "" : {
    "title" : "-- SubMenu --",
    "back": function() { E.showMenu(mainmenu); }
  },
  "test": "",
};

E.showMenu(mainmenu);
  1. State of submenu:
>submenu
={
  "": {
    title: "-- SubMenu --",
    back: function () { ... }
   },
  test: ""
 }
  1. Entering the submenu:
>E.showMenu(submenu)
={ lastIdx: 0,
  draw: function (a,b) { ... },
  select: function () { ... },
  move: function (a) { ... },
  back: function () { ... }
 }
>
>submenu
={
  "": {
    title: "-- SubMenu --",
    back: function () { ... },
    fontHeight: 16, selected: 0 },
  test: "",
  "< Back": function () { ... }
 }

At this point however, the menu renders correctly with only one < Back option.

  1. Leave the submenu and enter it again:
>E.showMenu(mainmenu)
={ lastIdx: 0,
  draw: function (a,b) { ... },
  select: function () { ... },
  move: function (a) { ... },
  back: function () { ... }
 }
>
>E.showMenu(submenu)
={ lastIdx: 0,
  draw: function (a,b) { ... },
  select: function () { ... },
  move: function (a) { ... },
  back: function () { ... }
 }

This time, there will be two < Back options, one at the top and one at the bottom, both working.

@gfwilliams
Copy link
Member

Thanks! That's a pain - I'm surprised this hasn't come up before as it will have been like this for a while, but maybe for the majority of uses E.showMenu gets called with a newly created argument each time so it's not obvious.

Have you seen this on a real device, or is it emulator only?

@Erovia
Copy link
Author

Erovia commented Feb 26, 2024

This is reproducible on real hardware running 2v21 with all apps updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants