Leaving first-level tab selected when clicking on a subtab
I came back to study this problem further. If I am not mistaken, the active trail is not set from the local task to its parent menu link, even if the first local task is correctly set to the corresponding menu voice. I looked at a few modules and custom solution, and in the end I simply changed a bit my URLs and installed the module menu_trail_by_path, and I got the desired behaviour.