简体   繁体   中英

How do I get Combobox onSelect to work on React Bootstrap modal?

I have a React Bootstrap Modal in which is a Reach UI Combobox. The issue is, I can select the items from the Combobox when they are on the page but not in the Modal on left mouse click (it works with using the down arrow and hitting enter to select). The onSelect doesn't get triggered when in the modal.

I have a code sandbox at https://codesandbox.io/s/staging-butterfly-42fo2?file=/src/App.js where the issue is reproduced.

What's the issue and how do I get the click to work?

I found that playing with your code and setting https://reach.tech/combobox#comboboxpopover-portalto false works for me.

Give it a try.

glhf

Set the 'portal-props' of the ComboboxPopover to be 'false' will work:

<ComboboxPopover portal={false}>...</ComboboxPopover>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM