This repository was archived by the owner on Sep 11, 2024. It is now read-only.
Add body link fallback handler for in-app navigation #7627
Merged
Conversation
This adds a fallback click handler for all links in the message to ensure that links that were ignored as part of linkification (e.g. pills, links in message content) will still navigate in-app where possible. This approach preserves a side benefit of #7453, which kept all link hrefs as matrix.to style links (so that they can be easily copied and shared). Fixes element-hq/element-web#20715
kerryarchibald
approved these changes
Jan 25, 2022
Contributor
kerryarchibald
left a comment
There was a problem hiding this comment.
Looks good, left some nits and a question.
| * were ignored as part of linkification because they were already links | ||
| * to start with (e.g. pills, links in the content). | ||
| */ | ||
| private onBodyLinkClick = (e: MouseEvent): void => { |
Contributor
There was a problem hiding this comment.
Unsure if they worked before, but what about ctrl + clicking links in messages?
Collaborator
Author
There was a problem hiding this comment.
Ah hmm... IIRC, we have always forced in-app navigation (at least in recent times), but it does seem reasonable to support Ctrl/Cmd + Click to force a separate tab for those who want it. Since this is aimed at fixing a regression and that's effectively an enhancement, I'd say it's best to file an issue track that separately.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a fallback click handler for all links in the message to ensure that links that were ignored as part of linkification (e.g. pills, links in message content) will still navigate in-app where possible.
This approach preserves a side benefit of #7453, which kept all link hrefs as matrix.to style links (so that they can be easily copied and shared).
Fixes element-hq/element-web#20715
Regressed by #7453
This PR currently has no changelog labels, so will not be included in changelogs.
Add one of:
T-Deprecation,T-Enhancement,T-Defect,T-Taskto indicate what type of change this is plusX-Breaking-Changeif it's a breaking change.Preview: https://61f0086a29ac3143ccfbf492--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.