Iframe and url fragments

I am trying to solve an issue related to iframe component and url fragments.

I am trying to achieve this: when user clicks on <a> element, which has target of iframe. On iframe load, if there is fragment in the url, iframe scrolls to target position on first click.

However iframe is not being scrolled to target element on first click. Iframe has to be loaded in advance, so iframe scrolls to target element on second and other clicks.

This issue is not present in Vaadin 8.

I have created question on SO: java - Vaadin 24 iframe is not scrolling to fragment on first load - Stack Overflow, which clarifies this issue a little more with a practical example.

Thanks in advance

#is not working - see <a href="#anchor"> does not link to <a name="anchor> in same page · Issue #1215 · vaadin/flow · GitHub

It should be possible with custom logic on either the client or server side which parses the name/id behind your hash tag and afterwards scroll the given component into view. (Component::scrollIntoView())

Thanks for reply, however linked GitHub issue is something different.

I am trying to scroll into view first time html document is loaded into iframe. (it works second and other times, once it is loaded)

I tried using Component::scrollIntoView, but it does not work. In fact, i tried custom client/server side logic via executing js: executeJs method and in afterNavigation and beforeEnter methods (AfterNavigationObserver, BeforeEnterObserver). Also trying to register various ‘on document load’ js listeners (Window: load event - Web APIs | MDN,
Document: DOMContentLoaded event - Web APIs | MDN)