You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RouterLink should support _blank, _self, _top targets #5791
Hi @khauser , care to elaborate what type of UX you're after? Is it e.g. to be able to get the user to open a navigation target (@Route) in a new window, like using _blank ?
For that case actually the Achor component should be used instead of RouterLink and the browser will handle everything for you. But it does lack the similar API as RouterLink to create the link easily based on a registered route in the application.
The use case: open a route in a new tab while keeping RouterLink's typed route API. That means the route class + parameters, setQueryParameters() and HighlightCondition. With Anchor I have to build the URL by hand through RouteConfiguration.getUrl(), and the highlighting is gone. Ctrl/middle-click already opens a RouterLink in a new tab, but users don't know it, and the app can't ask for it.
Proposal, the same shape SideNavItem already has:
publicvoidsetTarget(Stringtarget) // null or "" removes the attributepublicStringgetTarget() // null when unsetpublicvoidsetOpenInNewBrowserTab(booleanopenInNewBrowserTab) // sets or removes "_blank"publicbooleanisOpenInNewBrowserTab()
AnchorTargetValue can't appear in the signature. It lives in flow-html-components, which depends on flow-server, where RouterLink lives.
Verified on Vaadin 25.2.9 with the React router: with target="_blank" set on the element, the client router leaves the click alone (Flow.tsxextractURL() skips any target other than _self), no RPC reaches the server, and the route opens in a new tab with a fresh UI. _self is still routed in place. So this needs server API only, no client change. Workaround until then: routerLink.getElement().setAttribute("target", "_blank").
Activity
khauser commentedon Jun 24, 2019
ah, it's a PWA
pleku commentedon Oct 9, 2019
Hi @khauser , care to elaborate what type of UX you're after? Is it e.g. to be able to get the user to open a navigation target (
@Route) in a new window, like using_blank?For that case actually the
Achorcomponent should be used instead ofRouterLinkand the browser will handle everything for you. But it does lack the similar API asRouterLinkto create the link easily based on a registered route in the application.mvysny commentedon Sep 30, 2026
The use case: open a route in a new tab while keeping
RouterLink's typed route API. That means the route class + parameters,setQueryParameters()andHighlightCondition. WithAnchorI have to build the URL by hand throughRouteConfiguration.getUrl(), and the highlighting is gone. Ctrl/middle-click already opens aRouterLinkin a new tab, but users don't know it, and the app can't ask for it.Proposal, the same shape
SideNavItemalready has:AnchorTargetValuecan't appear in the signature. It lives inflow-html-components, which depends onflow-server, whereRouterLinklives.Verified on Vaadin 25.2.9 with the React router: with
target="_blank"set on the element, the client router leaves the click alone (Flow.tsxextractURL()skips any target other than_self), no RPC reaches the server, and the route opens in a new tab with a fresh UI._selfis still routed in place. So this needs server API only, no client change. Workaround until then:routerLink.getElement().setAttribute("target", "_blank").If this shape is OK, I'll send a PR against 25.
feat: add setTarget to RouterLink (vaadin#26067)
vaadin-bot commentedon Oct 22, 2026
This ticket/PR has been released with Vaadin 25.4.0-alpha4.