We have an application built with 3.24 API based on a web map in Portal for ArcGIS. Some of the layers are not visible in the web map initially (parent group layer visible but not sub layer), but the pop-up has been configured and enabled for all layers. This works as expected within the Portal.
With a layer list widget configured to the web map, layer visibility is toggled within the application. For layers that were not visible within the web map, pop-up does not appear.
Here is a screenshot of a web map within the sample app for layer list. It shows the pop up for a layer that is set as visible within the web map.

When I toggle the other layer on and zoom-in, I still get the pop-up of previous layer.

Even when I turn the layer's visibility off, I still don't get the pop-up of the now visible layer.

Whereas in the web-map, once the pop-up seems to be working as expected. It shows both the layer's pop-up, but it considers all visible layers.

The screenshots are from a sample app that uses the 3.28 version of the API.
Is this a limitation of the API? Is there any way to enable the pop-up set in the web map when the layer visibility is toggled on?