focusable-child

GENERIC: focusable-child* ( gadget -- child/t )

M: gadget focusable-child*
    drop t
    ;

: focusable-child ( gadget -- child/gadget )

    dup focusable-child*        ! gadget child/t
    dup t eq?                   ! gadget t not-found
    [                           ! gadget t
        drop                    ! gadget
        ]
    [                           ! gadget child
        nip                     ! child
        focusable-child         ! focusable
        ]
    if
    ;