Skip to content

[Bug]: aria-hidden is not removed when Dialog is unmounted #35139

@Aidam1

Description

@Aidam1

Component

Dialog

Package version

9.68.0

React version

18.3.1

Environment

System:
    OS: Windows 10 10.0.19045
    CPU: (6) x64 Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz
    Memory: 12.67 GB / 31.95 GB
  Browsers:
    Chrome: 139.0.7258.139
    Edge: Chromium (139.0.3405.125)
    Internet Explorer: 11.0.19041.5794
  npmPackages:
    @fluentui/react: ^8.115.6 => 8.118.2
    @fluentui/react-components: ^9.68.0 => 9.68.0
    @fluentui/react-icons: ^2.0.231 => 2.0.307
    @fluentui/react-migration-v8-v9: ^9.3.7 => 9.6.11
    @types/react: ^18.2.61 => 18.3.2
    @types/react-dom: ^18.2.19 => 18.3.0
    react: ^18.2.0 => 18.3.1
    react-dom: ^18.2.0 => 18.3.1

Current Behavior

When the Dialog with Buttons is open, it sets aria-hidden=true to root element. However, when the dialog is unmounted, the aria-hidden is still kept on this element.

This also breaks tests with Playwright, since this causes page.getByRole() to ignore elements in root after the unmount of Dialog.

Expected Behavior

After the Dialog is unmounted, it should also remove aria-hidden from the root element.

Reproduction

https://stackblitz.com/edit/a68hlhkw-4bg8gkb7?file=src%2Fexample.tsx

Steps to reproduce

  1. Click on Open Dialog button
  2. It is displayed for 2 seconds, and aria-hidden is added to div id="root"
  3. After 2 seconds, the dialog is unmounted, but the aria-hidden is still kept in div id="root"

Are you reporting an Accessibility issue?

yes

Suggested severity

Low - Has or doesn't need a workaround

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions