Skip to content

Place selection not working with mouse click on radix ui dialog component #239

@harshil-getrevscale

Description

@harshil-getrevscale

Issue Description:
When using the ReactGoogleAutocomplete component inside a Radix UI dialog, the place selection works fine when navigating with the keyboard and pressing "Enter". However, when trying to select a place using a mouse click, the dropdown closes without selecting the place, and the input remains unchanged.

Steps to Reproduce:

  1. Integrate the ReactGoogleAutocomplete component inside a Radix UI dialog.
  2. Open the dialog and start typing in the autocomplete input.
  3. Use the mouse to click on one of the suggested places from the dropdown.

Expected Behavior:
The selected place should populate the input field when clicked with the mouse.

Actual Behavior:
Clicking on a place in the dropdown does not populate the input field. Instead, the dropdown closes, and the input field remains unchanged.

Additional Information:
The issue seems to stem from the fact that the Radix UI dialog and the autocomplete dropdown are rendered outside of the main div, causing conflicts in handling the click events.
Placing the ReactGoogleAutocomplete component outside of the Radix UI dialog works as expected.

Environment:
@radix-ui/react-dialog: "^1.0.4",
react-google-autocomplete: "^2.7.3",
Browser: Chrome,
OS: Ubuntu 22.04.3 LTS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions