From 5799c1084398b365c7a9669406d4fbe258a501ef Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 13 Oct 2021 13:24:34 +0200 Subject: [PATCH] fix(group) skip object if an of the parents is hidden Previously only the object itself was checked for hidden. --- src/core/lv_group.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/lv_group.c b/src/core/lv_group.c index 281d67cb0..8050caf2c 100644 --- a/src/core/lv_group.c +++ b/src/core/lv_group.c @@ -395,8 +395,16 @@ static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *) if(obj_next == NULL) continue; if(lv_obj_get_state(*obj_next) & LV_STATE_DISABLED) continue; - /*Hidden objects don't receive focus*/ - if(lv_obj_has_flag(*obj_next, LV_OBJ_FLAG_HIDDEN) == false) break; + /*Hidden objects don't receive focus. + *If any parent is hidden, the object is also hidden)*/ + lv_obj_t * parent = *obj_next; + while(parent) { + if(lv_obj_has_flag(parent, LV_OBJ_FLAG_HIDDEN)) continue; + parent = lv_obj_get_parent(parent); + } + + /*If we got her a good candidate is found*/ + break; } if(obj_next == group->obj_focus) return; /*There's only one visible object and it's already focused*/