Skip to content

[Bug]: Toaster runs past the left edge of viewports narrower than 292px and takes pointer events there #36960

Closed as not planned

Description

Component

Toaster

Package version

@fluentui/react-toast 9.6.20 (@fluentui/react-components 9.74.10)

React version

19.3.1

Environment

System:
  OS: Windows 11 10.0.26300
  CPU: (24) x64 AMD Ryzen 9 7900X 12-Core Processor
  Memory: 13.83 GB / 31.16 GB
Browsers:
  Chrome: 155.0.8059.85
npmPackages:
  @fluentui/react-components: 9.74.10 => 9.74.10
  @fluentui/react-toast: 9.6.20 => 9.6.20
  react: 19.3.1 => 19.3.1
  react-dom: 19.3.1 => 19.3.1

Current Behavior

On a viewport narrower than the toast plus its edge offset, the Toaster runs past the left edge and the toast takes pointer events over whatever is underneath it along that edge.

The root slot is a reset style with a fixed width and no viewport clamp:

const useRootBaseClassName = makeResetStyles({
  position: 'fixed',
  width: '292px',
  pointerEvents: 'none',
});

The edge offset comes from getPositionStyles, which defaults to horizontal = 20 and vertical = 16. With the default bottom-end position the toast occupies 292 + 20 = 312px from the right edge, so any viewport below 312px pushes it off the left side.

Measured on Chrome 155.0.8059.85 with a single dispatchToast and position="bottom-end":

Viewport Toaster left Off-screen Topmost element at the left edge of the screen
400px 88 no HTML
320px 8 no HTML
300px -12 yes DIV.fui-Toast
280px -32 yes DIV.fui-ToastBody

The last column is document.elementFromPoint(6, mid-height-of-the-toast). Once the root starts at a negative left offset the toast itself is the topmost element along the left edge of the screen, so it swallows clicks on the content beneath it while it is visible.

pointer-events: none on the root does not help here because the toast re-enables pointer events inside, and the off-screen part of the toast sits over the left edge of the page.

Viewports this narrow are reachable: split view, an app embedded in a narrow host pane, and high browser zoom on a small display. Power Apps code apps in particular are often hosted in constrained panes.

Expected Behavior

The Toaster should stay inside the viewport at any width, the same way the toast content wraps rather than overflowing.

A max-width that reserves the default offset on both sides fixes it:

const useRootBaseClassName = makeResetStyles({
  position: 'fixed',
  width: '292px',
  maxWidth: 'calc(100vw - 40px)',
  pointerEvents: 'none',
});

At 280px that gives a 240px toast starting at x = 20, and at 320px and wider nothing changes. Consumers who set a larger offset.horizontal can override max-width on .fui-Toaster, and it would be reasonable to derive the clamp from the resolved offset in getPositionStyles instead if you prefer that.

The workaround in our app today is .fui-Toaster { max-width: calc(100vw - 40px) }, which is how I arrived at the suggested fix.

Reproduction

https://gist.github.com/jakesalvesen/19fd46a16f7db37af4aaa059cb8b1719 - a Cypress component test that measures the toaster box at a 280px viewport. It fails on master with left = -32 and passes with the max-width above. The comment at the bottom of the gist also has the two measurements to take in any browser without the harness.

Steps to reproduce

  1. Render Toaster with position="bottom-end" inside a FluentProvider and dispatch one toast with a ToastTitle.
  2. Set the browser viewport to 280px wide, or open DevTools device mode and pick a custom width of 280px.
  3. The toast renders with its left edge at x = -32. document.querySelector('.fui-Toaster').getBoundingClientRect().left is -32.
  4. Call document.elementFromPoint(6, y) at the vertical middle of the toast. It returns the toast body rather than the page content, so clicks at that point hit the toast.
  5. Add max-width: calc(100vw - 40px) to .fui-Toaster and repeat. The left offset becomes 20, the right edge stays inside the viewport, and elementFromPoint returns the page content again.

Are you reporting an Accessibility issue?

no

Suggested severity

Low - Has or doesn't need a workaround

Products/sites affected

Internal Power Apps code app that renders toasts on narrow and zoomed viewports

Are you willing to submit a PR to fix?

yes

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Activity

  1. jakesalvesen commented on Oct 21, 2026

    @jakesalvesen
    ContributorAuthor

    Fix PR: #36962. It clamps the Toaster root width to the viewport with max-width: calc(100vw - 40px) and adds a Cypress case that measures the box at a 280px viewport.

  2. jakesalvesen commented on Oct 23, 2026

    @jakesalvesen
    ContributorAuthor

    Hi team, I filed this outside the issue form by mistake, so the usual triage labels (Type: Bug, Needs: Triage, Fluent UI react-components (v9)) weren't applied. Would someone be able to add them when convenient? There's a fix with a regression test in #36962. Thank you!

  3. jakesalvesen commented on Nov 1, 2026

    @jakesalvesen
    ContributorAuthor

    Hi Tudor Popa (@tudorpopams), sorry to bother you. When you have a moment, could you take a look at this one too? I filed it without the issue form, so it never got the Needs: Triage label and may have missed the triage queue. The fix is in #36962. Thank you!

  4. jakesalvesen commented on Nov 11, 2026

    @jakesalvesen
    ContributorAuthor

    Superseded by #37124, which was filed through the issue template and carries the triage labels. Same report, with the package version corrected to @fluentui/react-toast 9.8.5 since 9.6.20 is not a published version. Closing this one so there is a single thread. The fix is still in #36962.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions