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
Link elements are a tags in rendered html, but have a dioxus-prevent-default="onclick" which I assume is not looking at the ctrl/cmd state when clicked to replicate the normal browser behavior. https://support.mozilla.org/en-US/questions/1336268 is a discussion of this problem in general (dioxus is not the first and only framework with this issue, but it is fixable.)
If you are not familiar with this workflow: ctrl clicking a "normal" link on the vast majority of websites will open the link in a new browser tab/window, but not so with Link elements in a current dioxus site. Consistency with typical browser behavior/usage seems desirable. (Thus this issue is being tagged as a bug rather than feature request.)
It's easy enough to find where normal link behavior is blocked:
But I'm not sure how quite to work with the router and/or browser to handle this behavior properly on the web -- especially given dioxus's cross platform nature of desktop vs web, etc where ctrl click opening a new tab perhaps does not make sense except only in a browser. It seems like some kind of override is needed for web to handle this consistently with that the typical behavior unique for that platform (browsers). Given pointers on where the appropriate (i.e. acceptable to the team) place to make such an override would be, I'll happily attempt to make the changes myself.
Problem
Link
elements area
tags in rendered html, but have adioxus-prevent-default="onclick"
which I assume is not looking at thectrl
/cmd
state when clicked to replicate the normal browser behavior. https://support.mozilla.org/en-US/questions/1336268 is a discussion of this problem in general (dioxus is not the first and only framework with this issue, but it is fixable.)If you are not familiar with this workflow: ctrl clicking a "normal" link on the vast majority of websites will open the link in a new browser tab/window, but not so with
Link
elements in a current dioxus site. Consistency with typical browser behavior/usage seems desirable. (Thus this issue is being tagged as a bug rather than feature request.)It's easy enough to find where normal link behavior is blocked:
dioxus/packages/web/src/dom.rs
Line 84 in 472031d
And I believe this is where link clicking is replaced:
dioxus/packages/router/src/components/link.rs
Line 265 in 472031d
But I'm not sure how quite to work with the router and/or browser to handle this behavior properly on the web -- especially given dioxus's cross platform nature of desktop vs web, etc where ctrl click opening a new tab perhaps does not make sense except only in a browser. It seems like some kind of override is needed for web to handle this consistently with that the typical behavior unique for that platform (browsers). Given pointers on where the appropriate (i.e. acceptable to the team) place to make such an override would be, I'll happily attempt to make the changes myself.
Steps To Reproduce
dx new
with routerdx serve
that new appExpected behavior
Ctrl clicking the "Go to blog" link should open in a new tab/window (depending on your browser config).
For comparison, go to https://www.google.com/ and ctrl click the "About" link in the top left, it will open in a new tab/window.
Environment:
web
Questionnaire
The text was updated successfully, but these errors were encountered: