I have anchor links (example: <a href="#P12"/>
) in my HTML which I load into a WebView and this WebView is inside a NestedScrollView. When I temporarily disable the NestedScrollView because everyone advises doing that when anchor links are not working properly, these anchor links work perfectly. However, my layout does need this NestedScrollView because of multiple reasons:
app:layout_behavior="@string/appbar_scrolling_view_behavior
needs to be set;The expected behaviour is that the content jumps to the correct part of the web page when an anchor link is clicked. The actual behaviour is that the content jumps to some random place and that you can no longer scroll through the entire page (either the top or bottom is cut off).
Is there a possibility to make these anchor links work inside my WebView that is inside a NestedScrollView?
On StackOverflow I have found one question that is similar to this one, but unfortunately it has no answers and it is from 2017 so I highly doubt anyone will answer it soon.
Since it frustrates me when I stumble upon a question without answers, I will answer my own question, so others will know how I resolved this issue.
Bad news is, this particular issue cannot be resolved. At least, not yet in 2021.
What the company I am working at and the client decided to do is change the entire implementation of this screen. The entire screen is now a WebView, instead of just a part of the screen being a WebView.