Share via

Outlook Office Add-in dropdown renders at top-left corner instead of near command button

Nguyễn Trọng Cảnh 5 Reputation points
2026-02-11T09:09:51.03+00:00

I am developing an Outlook Office Add-in (Web Add-in using Office.js).

My add-in has two sub-features:

  • A Settings popup
  • A Task pane for processing email data

When the user clicks the Apps button inside an email, Outlook shows the list of installed add-ins. After selecting my add-in, a dropdown menu appears that allows the user to choose between:

  1. Settings popup
  2. Task paneUser's image

User's image


Main Issue

When the dropdown opens, it renders at the top-left corner of the screen instead of appearing near the add-in command button.

It looks like the dropdown loses its anchor reference or positioning context.User's image


Environment

  • New Outlook (Microsoft 365)
  • Office Add-in (manifest-based)
  • Office.js
  • Occurs when launched from the Apps button inside an email

There is another behavior that may be related to the same positioning problem:

If the user:

Clicks the Apps button (the add-in list opens),

Does not select any add-in,

Scrolls the mail list pane,

The add-in list panel immediately jumps to the top-left corner of the screen.

This appears to indicate that the Apps flyout loses its anchor reference when the mail list container reflows or scrolls.

This behavior occurs even before interacting with my add-in

User's image

Questions

  1. Why would the dropdown render at top-left corner instead of anchoring to the add-in button?
  2. Is this related to Outlook's rendering lifecycle or container positioning?
  3. Is there a recommended way to properly anchor a dropdown UI inside an Outlook add-in command?
  4. Should this scenario be implemented using a different command type (e.g., separate ribbon commands instead of a custom dropdown)?

Any technical guidance or best practice recommendations would be appreciated.

Thank you.

Microsoft 365 and Office | Development | Office JavaScript API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jack-Bu 6,675 Reputation points Microsoft External Staff Moderator
    2026-02-11T14:50:17.4966667+00:00

    Hello Nguyễn Trọng Cảnh

    Thank you for reaching out to Microsoft Q&A about the Outlook add-in behavior. The issue typically stems from fixed positioning that fails to adjust for scroll offsets or the limits of the add-in's iframe/webview container; Or outlook's habit of refreshing its UI during scroll events, such as in the email list, which can throw off the positioning references for elements attached to the document body. Here something you can do to fix this:

    Use Native Manifest-Defined Menus for Simple Dropdowns: If your dropdown is static (a list of options triggering functions), define it in your add-in's manifest.xml. This lets Outlook handle positioning natively, avoiding custom JS/CSS issues.

    <Control xsi:type="Menu" id="MyDropdown">
      <Label resid="MyDropdownLabel" />
      <Items>
        <Item id="Item1">
          <Label resid="Item1Label" />
          <Action xsi:type="ExecuteFunction">
            <FunctionName>myFunction1</FunctionName>
          </Action>
        </Item>
        <!-- Add more items -->
      </Items>
    </Control>
             
    

    Reference: https://learn.microsoft.com/en-us/office/dev/add-ins/design/add-in-commands

    If you need a dynamic dropdown, calculate positions relative to the button and reposition on scroll.

    function showDropdown(buttonElement) {
      const dropdown = document.getElementById('myDropdown');
      const rect = buttonElement.getBoundingClientRect();
      dropdown.style.position = 'absolute';
      dropdown.style.top = `${rect.bottom + window.scrollY}px`;
      dropdown.style.left = `${rect.left + window.scrollX}px`;
      dropdown.style.display = 'block';
    
      // Reposition on scroll
      const reposition = () => {
        const newRect = buttonElement.getBoundingClientRect();
        dropdown.style.top = `${newRect.bottom + window.scrollY}px`;
        dropdown.style.left = `${newRect.left + window.scrollX}px`;
      };
      window.addEventListener('scroll', reposition, true);
      // Clean up listener on close
    }
            
    

    Please test these in both Outlook web and desktop (ensure you're on the latest Microsoft 365 updates). Use browser dev tools (F12) to inspect coordinates post-scroll.

    Hope this help.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.