Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iFrame click events not firing #7579

Closed
spfautz opened this issue Jul 26, 2017 · 5 comments
Closed

iFrame click events not firing #7579

spfautz opened this issue Jul 26, 2017 · 5 comments

Comments

@spfautz
Copy link

spfautz commented Jul 26, 2017

Description:

Click events are not triggered from Rocket.Chat when iFrame integration is enabled.

  • click-user-card-message
  • click-mention-link
  • click-message-link
  • click-action-link

The other events (notification, room-opened, new-message, etc.) work as expected.

Server Setup Information:

  • Version of Rocket.Chat Server: 0.57.2
  • Operating System: Linux (x64)
  • Deployment Method(snap/docker/tar/etc): docker
  • Number of Running Instances: 1

Steps to Reproduce:

  1. Embed Rocket.Chat in to iFrame
  2. Add event listener:
    window.addEventListener('message', function(e) {
    console.log(e.data.eventName); // event name
    console.log(e.data.data); // event data
    });
  3. Send a message with a link (http://www.google.com) and click on it, or click on a username or mention link.

Expected behavior:

The event listener is fired with a "click-message-link" eventName (or action/mention/user-card) and associated event data.

Actual behavior:

The event listener is not triggered.

Other:

Chrome Version 59.0.3071.115 (Official Build) (64-bit)

@mikewakid
Copy link

mikewakid commented Aug 25, 2017

I am having the same issue as the poster with the click events not triggering, the others are working as expected.

@kieran-rocks
Copy link

+1

@kieran-rocks
Copy link

kieran-rocks commented Oct 5, 2017

Looks like the problem is in Rocket.Chat/packages/rocketchat-ui-master/client/main.js:
@karlprieb #6498

if (link.origin === s.rtrim(Meteor.absoluteUrl(), '/') && /msg=([a-zA-Z0-9]+)/.test(link.search))

Both link.origin and link.search are undefined, so this check is false and does not even get to the following check:

if (RocketChat.Layout.isEmbedded()) {

which is also returning false. All three of these checks should be true, which would result in:

return fireGlobalEvent('click-message-link',

but as it stands it never gets there to send the message, and instead the message is propagated and the browser just does its thing (opens link in new tab). Perhaps link.baseURI should be used for that check in place of link.origin, if it is necessary at all. I'm not sure what the purpose of testing link.search is.

@Fred-grais
Copy link

still an issue on the latest version

@gabriellsh
Copy link
Member

Fixed in #16771

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants