Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Fix @name:server links to not open new tab#7550

Closed
toger5 wants to merge 1 commit into
developfrom
toger5/fix_links_to_not_open_new_tab
Closed

Fix @name:server links to not open new tab#7550
toger5 wants to merge 1 commit into
developfrom
toger5/fix_links_to_not_open_new_tab

Conversation

@toger5
Copy link
Copy Markdown
Contributor

@toger5 toger5 commented Jan 14, 2022

These links should be converted to href="#/something/something"` so that they are opened inside element and not inside a new tab.


Here's what your changelog entry will look like:

🐛 Bug Fixes

Preview: https://61e1c220d8aa354e176044e7--matrix-react-sdk.netlify.app
⚠️ Do you trust the author of this PR? Maybe this build will steal your keys or give you malware. Exercise caution. Use test accounts.

@toger5 toger5 requested a review from a team as a code owner January 14, 2022 18:30
@toger5 toger5 changed the title @name:server.foo links did open new tab @name:server.foo links did open a new tab Jan 14, 2022
@t3chguy t3chguy added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label Jan 17, 2022
@t3chguy t3chguy changed the title @name:server.foo links did open a new tab Fix @name:server links to not open new tab Jan 17, 2022
@t3chguy
Copy link
Copy Markdown
Member

t3chguy commented Jan 17, 2022

I don't think this is the right approach, this means that right click - copy link will now no longer copy the matrix.to link which it should.
There should be an onclick handler on this link to intercept it. e.g

case Type.UserId:
return {
// @ts-ignore see https://linkify.js.org/docs/options.html
click: function(e) {
onUserClick(e, href);
},
};
case Type.RoomAlias:
return {
// @ts-ignore see https://linkify.js.org/docs/options.html
click: function(e) {
onAliasClick(e, href);
},
};
case Type.GroupId:
return {
// @ts-ignore see https://linkify.js.org/docs/options.html
click: function(e) {
onGroupClick(e, href);
},
};
}

@toger5
Copy link
Copy Markdown
Contributor Author

toger5 commented Jan 17, 2022

I was wondering about the same thing now as well (while reading more about linkifyjs)
So debugging why the onclick handler is not set up correctly would be the right approach then?
Then there is a bug in sending: https://matrix.to/#/@toger5:matrix.org in a matrix room which gets converted to: href="#/user/@toger5:matrix.org" and then results in: https://develop.element.io/#/user/@toger5:matrix.org when copying the link (using the firefox right click menu)

@t3chguy
Copy link
Copy Markdown
Member

t3chguy commented Jan 17, 2022

So debugging why the onclick handler is not set up correctly would be the right approach then?

Yup ideally

@toger5
Copy link
Copy Markdown
Contributor Author

toger5 commented Jan 17, 2022

Then there is a bug in sending: https://matrix.to/#/@toger5:matrix.org in a matrix room which gets converted to: href="#/user/@toger5:matrix.org" and then results in: https://develop.element.io/#/user/@toger5:matrix.org when copying the link (using the firefox right click menu)

And this is also the wrong behaviour right? we want the right click to copy: https://matrix.to/#/@toger5:matrix.org

@t3chguy
Copy link
Copy Markdown
Member

t3chguy commented Jan 17, 2022

Yeah

@toger5 toger5 closed this Jan 17, 2022
@toger5
Copy link
Copy Markdown
Contributor Author

toger5 commented Jan 17, 2022

Thanks for the input. This issue will be tackled in a different pr with a better approach!

@t3chguy t3chguy deleted the toger5/fix_links_to_not_open_new_tab branch January 17, 2022 10:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants