# Zoom chat window appear in unexpected location

**URL:** <https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701>\
**Category:** Web\
**Created:** [July 22, 2022, 10:23am UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701 "2022-07-22T10:23:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wang.shuochen](https://avatars.discourse-cdn.com/v4/letter/w/7ea924/32.png) [@wang.shuochen](https://devforum.zoom.us/u/wang.shuochen)\
**Post date:** [July 22, 2022, 10:23am UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/1 "2022-07-22T10:23:19Z")

</div>

**Description**  
The zoom chat window does nest in the located div but it comes in a different div and override all css properties.

**Which Web Meeting SDK version?**  
2.5.0

**Meeting SDK Code Snippets**  
The code snippets that are causing the error / issue so we can reproduce.

```auto
    const zmClient = ZoomMtgEmbedded.createClient();
    let meetingSDKChatElement = document.getElementById('meetingSDKChatElement')
    const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0)
    const vh = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0)
    await zmClient.init({
        zoomAppRoot: document.getElementById(conf.zoomAppRoot),
        assetPath: conf.assetPath,
        language: 'ja-JP',
        customize: {
            video: {
                viewSizes: {
                    default:{
                        width: vw * 0.9,
                        height: vh * 0.4
                    }
                }
              },
            chat: {
                popper: {
                  anchorElement: meetingSDKChatElement,
                }
            }
        }
    });

```

The html document

```auto
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>WebSDK Component</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.4.1/dist/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

  <style>
    .container {
      display: flex;
      flex-flow: row wrap;
      align-content: space-evenly;
    }
    </style>

  <style>
      .image {
      display: block;
      margin-left: auto;
      margin-right: auto;
      max-width: 1080px;
      width: 100%;
      max-height: 150px;
      } 
  </style>

</head>
<body>
    <script src="/static/myzm.js?nonce={{nonce}}"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script>
        document.addEventListener("readystatechange", async () => {
          if (document.readyState == "complete") {
            await myzm.start({
              zoomAppRoot: "ZoomEmbeddedApp",
              assetPath: "/static/zoomlib/av",
              meetingNumber: "{{meetingId}}",
              passCode: "{{passCode}}",
              sdkKey: "{{sdkKey}}",
              signature: "{{signature}}"
            });
          }
        });
    </script>
    <script>    
    // https://stackoverflow.com/questions/5525071/how-to-wait-until-an-element-exists
      function waitForElm(selector) {
          return new Promise(resolve => {
              if (document.querySelector(selector)) {
                  return resolve(document.querySelector(selector));
              }

              const observer = new MutationObserver(mutations => {
                  if (document.querySelector(selector)) {
                      resolve(document.querySelector(selector));
                      observer.disconnect();
                  }
              });

              observer.observe(document.body, {
                  childList: true,
                  subtree: true
              });
          });
      }
      waitForElm('.zmwebsdk-MuiSvgIcon-root').then((elm) => {
          $(".zmwebsdk-MuiSvgIcon-root")[8].closest("button").click();
          $(".zmwebsdk-MuiListItem-button")[0].click()
          window.scrollTo({ top: 0, behavior: 'smooth'});
      });

    </script>
    <div class="container">
      <div class="row">
        <div>
          <a href="https://www.meijiyasuda.co.jp/find/soudanyoyaku/index.html" target="_blank">
            <img src="/static/mv.png", alt="Meiji", class="image">
          </a>
        </div>
      </div>
      <div class="row">
        <div id="ZoomEmbeddedApp", class="col-sm-9"></div>
        <div id="meetingSDKChatElement", class="col-sm-3"></div>
      </div>
      <!-- JavaScript Bundle with Popper -->
      <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
    </div>
</body>
</html>

```

**Screenshots**  
This is the div that I specified

 ![Screen Shot 2022-07-22 at 19.20.13](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/a/c/ace24077482c761544d72d7ab92fe5195648a939.png)

But the chat window appears here instead

 ![Screen Shot 2022-07-22 at 19.20.28](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/d/5/d5cc7835d65eb690e426cd5671948b9562b94373.png)

**Device (please complete the following information):**

- Device: [Macbook Pro]
- OS: [macOS 12]
- Browser: [Chrome]
- Browser Version [Version 103.0.5060.134 (Official Build) (x86\_64)]

**Additional context**  
I literally copy and paste the code from

> **[Positioning](https://marketplace.zoom.us/docs/sdk/native-sdks/web/component-view/positioning/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

The widgets are out of place as well. Is caused by the new version??

 ![Screen Shot 2022-07-22 at 20.51.38](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/8/1/8121c3f40aa6ed14a6896fc249e21e172ee0c620.png)

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 22, 2022, 6:12pm UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/2 "2022-07-22T18:12:50Z")

</div>

check the result of “let meetingSDKChatElement = …”, does it finds the correct DOM node?

Jürgen

---

<div class="post-metadata">

**Author:** ![wang.shuochen](https://avatars.discourse-cdn.com/v4/letter/w/7ea924/32.png) [@wang.shuochen](https://devforum.zoom.us/u/wang.shuochen)\
**Post date:** [July 23, 2022, 12:59am UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/3 "2022-07-23T00:59:34Z")

</div>

> [@j.schoenemeyer](#):
>
> let meetingSDKChatElement =

Yes it does. I tested in the console.

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 23, 2022, 10:22am UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/4 "2022-07-23T10:22:04Z")

</div>

don’t check this problem in the brower debug console - check it directly in **your** javascript

for objects maybe even: console.log(JSON.stringify(obj));

if your javascript is executed too early, it may be that the DOM tree is not yet rendered, then javascript will not find DOM node

if all timing errors are excluded, you can of course test very well in the brower debug console

Jürgen

---

<div class="post-metadata">

**Author:** ![wang.shuochen](https://avatars.discourse-cdn.com/v4/letter/w/7ea924/32.png) [@wang.shuochen](https://devforum.zoom.us/u/wang.shuochen)\
**Post date:** [July 25, 2022, 4:51am UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/5 "2022-07-25T04:51:53Z")

</div>

Yes I am fully aware of what you are saying. And it does feel like a logical reason of why this would not work. I changed the console.log and it can output the correct div. So this was not the problem.

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [July 25, 2022, 7:12am UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/6 "2022-07-25T07:12:14Z")

</div>

then it seems to be a zoom api error. The big Javascript patch solution ’ mutationobserver’ → move the complete sub DOM tree to the correct position is probably not an adequate solution for this problem.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [August 24, 2022, 5:12pm UTC](https://devforum.zoom.us/t/zoom-chat-window-appear-in-unexpected-location/72701/7 "2022-08-24T17:12:30Z")

</div>

Closed on August 24, 2022, 5:12pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
