Skip to content

fix(MessageView): unbreak opening URLs when clicking on a text message#20939

Merged
caybro merged 2 commits into
release/2.38.xfrom
fix/20894-messageview-open-links
May 20, 2026
Merged

fix(MessageView): unbreak opening URLs when clicking on a text message#20939
caybro merged 2 commits into
release/2.38.xfrom
fix/20894-messageview-open-links

Conversation

@caybro
Copy link
Copy Markdown
Member

@caybro caybro commented May 18, 2026

What does the PR do

  • use a StatusTextArea as the internal part (renderer) of the StatusTextMessage and make it always enabled (disabling prevents the URLs from being opened)
  • by using a (Status)TextArea instead of a TextEdit, we can handle the context menu events correctly w/o disabling the edit control
  • additional commit to fix opening the chat image previews (and their ctx menus)

Fixes #20894
Fixes #20897

Affected areas

MessageView/Status(Text)Message

Quality checklist

Screencapture of the functionality

Opening a link:
image

Context menu (on touch):
image

Impact on end user

  • can open web links

How to test

  • click on a link in chat
  • long press / right click on a text message (both in and outside of the text)

Risk

low

@caybro caybro requested review from jrainville and sunleos May 18, 2026 22:27
wrapMode: root.convertToSingleLine ? Text.NoWrap : Text.Wrap
readOnly: true
selectByMouse: true // applies to mouse only, not touch
enabled: !Utils.isMobile // eats the internal touch events to enable the external context menu on long press
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main fix; we need the (edit) control always enabled for the URLs to be clickable

}
onLinkHovered: (link) => disabledLinkTooltip.visible = d.showDisabledTooltipForAddressEnsName(link)

// context menu handlers
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but we need to handle the context menus differently

root.messageStore.resendMessage(root.messageId)
}

onContextMenuRequested: pos => root.openMessageContextMenu(pos) // for StatusTextMessage which would eat the press events internally
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w/o this, the context menu wouldn't work when right clicking over the text itself; the TextEdit/TextArea has an intrinsic MouseArea that eats the events

}

TextEdit {
StatusTextArea {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change from a TextEdit -> TextArea is needed as the latter at least exposes the pressAndHold and pressed signals, unlike the simple TextEdit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need to test all platforms before merging to make sure this doesn't have a weird side-effect, since it's so core to the messaging part.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, needs testing for sure but I don't expect any breakage messaging-wise, (Status)TextArea inherits from the prior TextEdit, just adds background and those additional signals that we need to use here

@status-im-auto
Copy link
Copy Markdown
Member

status-im-auto commented May 18, 2026

Jenkins Builds

Click to see older builds (25)
Commit #️⃣ Finished (UTC) Duration Platform Result
a3b74a6 1 2026-05-18 22:34:47 ~7 min ios/aarch64 📄log
a3b74a6 1 2026-05-18 22:35:00 ~7 min macos/aarch64 📄log
✔️ a3b74a6 1 2026-05-18 22:36:16 ~9 min tests/nim 📄log
✔️ a3b74a6 1 2026-05-18 22:38:22 ~11 min android/arm64 🤖apk 📲
✔️ a3b74a6 1 2026-05-18 22:38:52 ~11 min tests/ui 📄log
✔️ a3b74a6 1 2026-05-18 22:45:49 ~18 min linux/x86_64 📦tgz
✔️ a3b74a6 1 2026-05-18 22:49:59 ~22 min windows/x86_64 💿exe
a3b74a6 2 2026-05-18 22:55:13 ~7 min macos/aarch64 📄log
a3b74a6 2 2026-05-18 22:55:14 ~7 min ios/aarch64 📄log
✔️ a3b74a6 11297 2026-05-18 23:06:44 ~20 min tests/e2e 📊rpt
✔️ a3b74a6 3250 2026-05-18 23:07:29 ~17 min tests/e2e-windows 📊rpt
✖️ a3b74a6 3274 2026-05-18 23:40:59 ~1 hr 2 min tests/e2e-android 📦pkg
b8af1ad 3 2026-05-19 07:40:17 ~7 min ios/aarch64 📄log
b8af1ad 3 2026-05-19 07:40:30 ~7 min macos/aarch64 📄log
✔️ b8af1ad 2 2026-05-19 07:41:41 ~9 min tests/nim 📄log
✔️ b8af1ad 2 2026-05-19 07:43:04 ~10 min android/arm64 🤖apk 📲
✔️ b8af1ad 2 2026-05-19 07:44:51 ~12 min tests/ui 📄log
✔️ b8af1ad 2 2026-05-19 07:50:47 ~18 min linux/x86_64 📦tgz
b8af1ad 4 2026-05-19 07:54:01 ~7 min ios/aarch64 📄log
b8af1ad 4 2026-05-19 07:57:31 ~11 min macos/aarch64 📄log
b8af1ad 5 2026-05-19 08:29:05 ~7 min ios/aarch64 📄log
b8af1ad 5 2026-05-19 08:29:13 ~7 min macos/aarch64 📄log
✔️ b8af1ad 3 2026-05-19 08:35:21 ~48 min windows/x86_64 💿exe
✖️ b8af1ad 3255 2026-05-19 08:52:22 ~16 min tests/e2e-windows 📊rpt
✖️ b8af1ad 3278 2026-05-19 08:58:53 ~1 hr 15 min tests/e2e-android 📦pkg
Commit #️⃣ Finished (UTC) Duration Platform Result
d7d4a7f 6 2026-05-19 15:57:28 ~5 min macos/aarch64 📄log
✔️ feac112 4 2026-05-19 16:08:38 ~8 min tests/nim 📄log
✔️ feac112 4 2026-05-19 16:09:47 ~9 min android/arm64 🤖apk 📲
feac112 7 2026-05-19 16:11:35 ~11 min ios/aarch64 📄log
✔️ feac112 7 2026-05-19 16:16:52 ~16 min macos/aarch64 🍎dmg
✔️ feac112 4 2026-05-19 16:17:02 ~16 min tests/ui 📄log
✔️ feac112 4 2026-05-19 16:18:27 ~18 min linux/x86_64 📦tgz
✔️ feac112 5 2026-05-19 16:22:49 ~22 min windows/x86_64 💿exe
✔️ feac112 8 2026-05-19 16:25:32 ~12 min ios/aarch64 📱ipa 📲
✔️ feac112 11321 2026-05-19 16:34:21 ~15 min tests/e2e 📊rpt
✖️ feac112 3274 2026-05-19 16:41:34 ~18 min tests/e2e-windows 📊rpt

@sunleos
Copy link
Copy Markdown
Collaborator

sunleos commented May 19, 2026

tested APK build 1:

The fix works but it has these two issues:

  1. the android selection modal appears as a side effect. See the video: https://drive.google.com/file/d/1wI253sUKPTiaBc2h1h1r8heiXB5SMs2r/view?usp=sharing
  2. the links are opened in the browser edit mode but should be opened in the browser view mode:
    steps: tap on a link and proceed with opening it in the app browser --> see that your link is opened in the browser edit mode
image

@caybro caybro force-pushed the fix/20894-messageview-open-links branch from a3b74a6 to b8af1ad Compare May 19, 2026 07:32
@caybro
Copy link
Copy Markdown
Member Author

caybro commented May 19, 2026

tested APK build 1:

The fix works but it has these two issues:

  1. the android selection modal appears as a side effect. See the video: https://drive.google.com/file/d/1wI253sUKPTiaBc2h1h1r8heiXB5SMs2r/view?usp=sharing

Got it, will fix

  1. the links are opened in the browser edit mode but should be opened in the browser view mode:
    steps: tap on a link and proceed with opening it in the app browser --> see that your link is opened in the browser edit mode

Yeah that bug is (being) fixed in the other PR (#20883)

Copy link
Copy Markdown
Member

@jrainville jrainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. We just need to test it out to be sure it doesn't have weird side effects

}

TextEdit {
StatusTextArea {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we need to test all platforms before merging to make sure this doesn't have a weird side-effect, since it's so core to the messaging part.

bottomPadding: 0
text: d.text
selectedTextColor: Theme.palette.directColor1
selectionColor: Theme.palette.primaryColor3
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it matters, but the selectionColor will now be primaryColor2 instead of primaryColor3

@caybro caybro linked an issue May 19, 2026 that may be closed by this pull request
caybro added 2 commits May 19, 2026 17:59
- use a StatusTextArea as the internal part (renderer) of the
StatusTextMessage and make it always enabled (disabling prevents the
URLs from being opened)
- by using a (Status)TextArea instead of a TextEdit, we can handle the
context menu events correctly w/o disabling the edit control

Fixes #20894
- on touch screens, the `button` is often `Qt.NoButton`
- also fixup opening the image context menus; on touch screens, the
Menu.popup() needs a point position to open at the exact point the user
(long)pressed

Fixes #20897
@caybro caybro force-pushed the fix/20894-messageview-open-links branch from d7d4a7f to feac112 Compare May 19, 2026 15:59
function onImageClicked(image, mouse, imageSource, url = "", pos = undefined) {
switch (mouse.button) {
case Qt.LeftButton:
case Qt.NoButton: // touch event
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the TapHandler simply reports Qt.NoButton if the event is not coming from a mouse, which makes sense

Copy link
Copy Markdown
Contributor

@friofry friofry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Copy link
Copy Markdown
Collaborator

@sunleos sunleos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested APK 4:

re

the android selection modal appears as a side effect. See the video: https://drive.google.com/file/d/1wI253sUKPTiaBc2h1h1r8heiXB5SMs2r/view?usp=sharing

confirming a successful fix for this issue

Great job!!!

Let's merge this PR.

Copy link
Copy Markdown
Member

@micieslak micieslak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Copy link
Copy Markdown
Collaborator

@noeliaSD noeliaSD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@caybro caybro merged commit 55f8f82 into release/2.38.x May 20, 2026
10 of 12 checks passed
@caybro caybro deleted the fix/20894-messageview-open-links branch May 20, 2026 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] can't open a sent image in the chat to see it [Mobile - Chat] tapping a web link in a sent message to open it in Browser doesn't work

7 participants