Internal UrlRequest intercept doesn’t work from a custom element?

It’s because elm/virtual-dom adds a click listener to every <a> element that it creates. That click listener is what results in onUrlRequest rather than a browser standard page load.

You can see how that _VirtualDom_divertHrefToApp function is set up here:

If elm/virtual-dom instead had listened for the click event on the whole document and checked if the click came from inside an <a> element, your case should have just worked. Not sure if that approach could have downsides. But patching the JS output to try to achieve this might be a workaround (unless someone comes up with some easier idea).

Edit: It might be easier to use html-parser 2.4.0 to parse the raw HTML into elm/virtual-dom nodes and render those. Then you get the link click listeners for free.