Workday / canvas-kit

Development kits to implement UI following the Workday Canvas Design System (https://canvas.workday.com/). See our Component Storybook -
https://workday.github.io/canvas-kit/
Apache License 2.0
303 stars 221 forks source link

Select popup should close when the target is clicked. #2753

Open mannycarrera4 opened 6 months ago

mannycarrera4 commented 6 months ago

🐛 Bug Report

Current behavior is the popup reopens when the input is clicked and the popup is already open.

To Reproduce

Steps to reproduce the behavior:

Expected Behavior

Popup should close when it is open and the target (input) is clicked. This change can probably be fixed in combobox since that seems to be the behavior for all combobox components.

NicholasBoll commented 6 months ago

This issue is unique to Select and not all comboboxes.

There's 2 input elements that make up the Select.Input. One is for the server via forms and FormData and the other is for the user. The server input element is the one the ref is forwarded to. So when the popup is registered, the server input is considered the "owner".

But when you mouse down on the input, you're interacting with the user one. When the PopupStack checks PopupStack.contains(), it thinks the element is not part of the popup and closes it.