LV_MENU main page dont back but

when we go back from submenu to main nothing is focused on display.
Seems focused is root BACK, but this is disabled.
Right is focused (blue bar) on menu from we go back. Howto solve ?

Please send a simple code example to reproduce.

Menu (lv_menu) — LVGL documentation

simple menu with custom header example controled with ENCODER

Sorry for the late reply. I’ve tried this example, but the encoder navigation is not really working for the menu at all.

The menu was added by an external contributor, so I’m not familiar with the details. If you see how it can be improved, please sen a pull request.

Yes this require add to group

void lv_menu_1(void)
{
  /*Create a menu object*/
  menu = lv_menu_create(ui_PanelMenu);
  lv_obj_set_size(menu, lv_disp_get_hor_res(NULL), lv_disp_get_ver_res(NULL) / 2);
  lv_obj_center(menu);

lv_obj_set_style_bg_color(menu, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT );
lv_obj_set_style_text_font(menu, &lv_font_montserrat_28, LV_PART_MAIN| LV_STATE_DEFAULT);

  /*Modify the header*/
  back_btn = lv_menu_get_main_header_back_btn(menu);
  lv_obj_t *back_btn_label = lv_label_create(back_btn);
  lv_label_set_text(back_btn_label, "Back");
  lv_group_add_obj(g1, back_btn);
  lv_obj_set_style_outline_color(back_btn, lv_color_hex(0xDDFD05), LV_PART_MAIN | LV_STATE_FOCUS_KEY );
  lv_obj_set_style_outline_width(back_btn, 3, LV_PART_MAIN| LV_STATE_FOCUS_KEY);

  lv_obj_t *cont;
  lv_obj_t *label;

  /*Create sub pages*/
  lv_obj_t *sub_1_page = lv_menu_page_create(menu, "Settings");

  cont = lv_menu_cont_create(sub_1_page);
  lv_obj_set_parent(ui_PanelMenuS1, cont);

  lv_group_add_obj(g1, ui_comp_get_child(ui_PanelMenu0, UI_COMP_PANELMENU1_SWITCHLM2));
  lv_group_add_obj(g1, ui_comp_get_child(ui_PanelMenu1, UI_COMP_PANELMENU1_SWITCHLM2));
lv_obj_set_style_outline_color(ui_comp_get_child(ui_PanelMenu0, UI_COMP_PANELMENU1_SWITCHLM2), lv_color_hex(0xDDFD05), LV_PART_MAIN | LV_STATE_FOCUS_KEY );
lv_obj_set_style_outline_opa(ui_comp_get_child(ui_PanelMenu0, UI_COMP_PANELMENU1_SWITCHLM2), 255, LV_PART_MAIN| LV_STATE_FOCUS_KEY);
lv_obj_set_style_outline_color(ui_comp_get_child(ui_PanelMenu1, UI_COMP_PANELMENU1_SWITCHLM2), lv_color_hex(0xDDFD05), LV_PART_MAIN | LV_STATE_FOCUS_KEY );
lv_obj_set_style_outline_opa(ui_comp_get_child(ui_PanelMenu1, UI_COMP_PANELMENU1_SWITCHLM2), 255, LV_PART_MAIN| LV_STATE_FOCUS_KEY);
lv_obj_set_style_outline_color(ui_Slider2, lv_color_hex(0xDDFD05), LV_PART_MAIN | LV_STATE_FOCUS_KEY );
lv_obj_set_style_outline_opa(ui_Slider2, 255, LV_PART_MAIN| LV_STATE_FOCUS_KEY);


  lv_obj_t *sub_2_page = lv_menu_page_create(menu, "");

  cont = lv_menu_cont_create(sub_2_page);
  lv_obj_set_parent(ui_PanelMenu2, cont);

  lv_group_add_obj(g1, ui_Slider2);

  lv_obj_t *sub_3_page = lv_menu_page_create(menu, "");

  cont = lv_menu_cont_create(sub_3_page);
  label = ui_PanelMenu1_create(cont);
  lv_obj_set_x( label, 0 );
  lv_obj_set_y( label, 0 );
  lv_obj_set_align( label, LV_ALIGN_TOP_LEFT );
  lv_label_set_text(ui_comp_get_child(label, UI_COMP_PANELMENU1_LABEL5),"Service mode BR");
  lv_obj_set_style_outline_color(ui_comp_get_child(label, UI_COMP_PANELMENU1_SWITCHLM2), lv_color_hex(0xDDFD05), LV_PART_MAIN | LV_STATE_FOCUS_KEY );
  lv_obj_set_style_outline_opa(ui_comp_get_child(label, UI_COMP_PANELMENU1_SWITCHLM2), 255, LV_PART_MAIN| LV_STATE_FOCUS_KEY);
  lv_group_add_obj(g1, ui_comp_get_child(label, UI_COMP_PANELMENU1_SWITCHLM2));
  lv_obj_add_event_cb(ui_comp_get_child(label, UI_COMP_PANELMENU1_SWITCHLM2), ui_event_menus, LV_EVENT_VALUE_CHANGED, NULL);

  lv_obj_t *sub_4_page = lv_menu_page_create(menu, "");

  cont = lv_menu_cont_create(sub_4_page);
  label = lv_label_create(cont);
  lv_label_set_text(label, "SW by M.M. ©2023");
  lv_obj_set_style_text_font(label, &ui_font_Font25, LV_PART_MAIN| LV_STATE_DEFAULT);
  cont = lv_menu_cont_create(sub_4_page);
  label2 = lv_label_create(cont);
  lv_obj_set_width(label2, 260);
  lv_label_set_text(label2, "THANKS LVGL");
  lv_obj_set_style_text_font(label2, &ui_font_Font25, LV_PART_MAIN| LV_STATE_DEFAULT);
  lv_label_set_long_mode(label2, LV_LABEL_LONG_SCROLL_CIRCULAR);

  /*Create a main page*/
  main_page = lv_menu_page_create(menu, NULL);

  cont = lv_menu_cont_create(main_page);
  label = lv_label_create(cont);
  lv_label_set_text(label, "Settings");
  lv_menu_set_load_page_event(menu, cont, sub_1_page);
  lv_group_add_obj(g1, cont);

  cont = lv_menu_cont_create(main_page);
  label = lv_label_create(cont);
  lv_label_set_text(label, "Displays");
  lv_menu_set_load_page_event(menu, cont, sub_2_page);
  lv_group_add_obj(g1, cont);

  cont = lv_menu_cont_create(main_page);
  label = lv_label_create(cont);
  lv_label_set_text(label, "Service");
  lv_menu_set_load_page_event(menu, cont, sub_3_page);
  lv_group_add_obj(g1, cont);

  cont = lv_menu_cont_create(main_page);
  label = lv_label_create(cont);
  lv_label_set_text(label, "About");
  lv_menu_set_load_page_event(menu, cont, sub_4_page);
  lv_group_add_obj(g1, cont);

  lv_menu_set_page(menu, main_page);
  lv_obj_add_event_cb(menu, ui_event_menus, LV_EVENT_ALL, NULL);
  lv_obj_add_event_cb(ui_comp_get_child(ui_PanelMenu0, UI_COMP_PANELMENU1_SWITCHLM2), ui_event_menus, LV_EVENT_VALUE_CHANGED, NULL);
  lv_obj_add_event_cb(ui_comp_get_child(ui_PanelMenu1, UI_COMP_PANELMENU1_SWITCHLM2), ui_event_menus, LV_EVENT_VALUE_CHANGED, NULL);

}

Sorry, but I myself have no time to look into it now. :frowning:
Contribution would be very welcome.

Ok this is for forum , now i have only one level menu then i solve it in cb

  if ( event_code == LV_EVENT_CLICKED) {
      //handle backs
      show_serial("Back1");
      lv_group_focus_next(g1);
  }

but ofcourse on back i dont see selected entered menu , but first only, better as nothing.