Leaving first-level tab selected when clicking on a subtab

I have a menu like the following defined in mymodule.links.menu.yml:

mymodule.page_memos:   title: 'List of memos'   description: 'View list of memos'   route_name: view.document_list.page_1   route_parameters: { doctype: 'memo'  }   menu_name: main   weight: 100  mymodule.page_letters:   title: 'List of letters'   description: 'View list of letters'   route_name: view.document_list.page_1   route_parameters: { doctype: 'letter'  }   menu_name: main   weight: 200  mymodule.page_notes:   title: 'List of notes'   description: 'View list of notes'   route_name: view.document_list.page_1   route_parameters: { doctype: 'note'  }   menu_name: main   weight: 300 

and then a list of tasks defined in mymodule.links.task.yml:

mymodule.document_list:   title: 'List of documents'   description: "View full list of documents"   route_name: view.document_list.page_1   base_route: view.document_list.page_1   weight: 10  mymodule.create_doc_by_type:   title: 'New document'   description: 'Insert new document'   route_name: mymodule.create_doc_by_type   base_route: view.document_list.page_1   weight: 20 

Everything work as expected, with three tabs in the main menu and two tabs in the task (they will soon become more). There is only a small visual glitch: when I click on tabs in the main menu, the last one clicked is correctly marked as active; when I click on tabs on the task menu, only the first one is ever marked as active. I am sure this has to be something really minor, but I really don’t know how to search for a solution.