View access does not work correctly with local tasks

Issue information

From user: tkasecker

Contribution record

Fork management

Problem/Motivation

When configuring a view with custom ECA access, the tab for the local task of that view is only shown when I'm currently visiting the path for that view. When I'm navigating to a different tab, the tab of the view with custom access is not displayed anymore.

Eg. when I'm on the URL mysite.com/node/1/myView the local tasks look like this:
local tasks show tab with custom access
when I'm on the URL mysite.com/node/1 the local tasks look like this:
local tasks don't show tab with custom access

Steps to reproduce

View:
- Make a view page with an url path, that is a sub-path to a content entity (eg. "node/%node/myView")
- Under "Page settings" -> "Menu" set a menu for the view with the type "Menu tab" and set a menu link title
- In the view under "Page settings" -> "Access" choose the option "ECA"
ECA:
- Created a model with the Event "Views: Access" and select the view in the plugin.
- Add the Action "Set access result" and set the access result to "allowed"
- Connect the Event and Action and save the model
Content:
- Create a content entity
- Navigate to the path of the view
---> You will see the tab of your view as a local task
- Navigate to another local task item (eg. view the content entity)
---> The local task of your view is not shown anymore

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Edited by drupalbot
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information