Skip to content

[Bug]: Menu component does not check for null refs in nodeToFocus #17155

@Adam-Shea

Description

@Adam-Shea

Package

@carbon/react

Browser

Firefox

Package version

11.63.2

React version

1.63.2

Description

Sometimes when rendering inside of an iframe I have found that the menu component throws an error

nodeToFocus.ref.current is null

I can only seem to replicate this issue within an iframe and it's hard to replicate manually. It's very similar to #16395
I have traced this down to packages/react/src/components/Menu/Menu.tsx line 268. I have found that by testing the nullishness of nodeToFocus.ref.current the issue gets resolved.

Reproduction/example

NA

Steps to reproduce

By having a menu inside of an iframe and quickly changing its contents.
I have found it difficult to replicate outside of our use case however I can replicate it consistently within our project

Suggested Severity

Severity 2 = User cannot complete task, and/or no workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions