Skip to content

iFrame click events not firing #7579

Closed
Closed

Description

@spfautz

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)

Activity

  1. mikewakid commented on Aug 25, 2017

    @mikewakid

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

  2. kieran-rocks commented on Aug 25, 2017

    @kieran-rocks

    +1

  3. kieran-rocks commented on Oct 5, 2017

    @kieran-rocks

    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.

  4. Fred-grais commented on Jan 13, 2019

    @Fred-grais

    still an issue on the latest version

  5. added
    area: ui/ux
    on Mar 2, 2020
  6. gabriellsh commented on Sep 19, 2023

    @gabriellsh
    Member

    Fixed in #16771

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: ui/uxtype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions