Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Modal now generates React warning using a function component as activator #10493

@gavin-hinchley

Description

@gavin-hinchley

Issue summary

Attempting to use functional components as an activator for Modal with Polaris11.13.0+results in
Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Appears to have been introduced with #10086
Could be related to #10337

Expected behavior

Functional components should continue to work without React errors or warnings.

Actual behavior

Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?
image

Steps to reproduce the problem

  1. Copy the Default ModalExample from the Modal Polaris documentation.
  2. Attempt to use the ModalExample in a unit test or browser.

Specifications

  • Are you using the React components? (Y/N): Y
  • Polaris version number: 11.19.0
  • Browser: Chrome 116.0.5845.140
  • Device: Mac
  • Operating System: MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething is broken and not working as intended in the system.ComponentPriority: MediumNon-blocking regression, noticable inconcistency, or important feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions