DouyinFE / semi-design

🚀A modern, comprehensive, flexible design system and React UI library. 🎨 Provide more than 3000+ Design Tokens, easy to build your design system. Make Semi Design to Any Design. 🧑🏻‍💻 Design to Code in one click
https://semi.design
Other
8.19k stars 695 forks source link

Select inside Popover, clicking the option to select it will cause the Popover hide #818

Closed pointhalo closed 2 years ago

pointhalo commented 2 years ago

Which Component 出现bug的组件

semi-ui version

Expected result 期望的结果是什么

Actual result 实际的结果是什么

Steps to reproduce 复现步骤

image

Reproducible code 复现代码

https://codesandbox.io/s/competent-glitter-5tmrc1?file=/src/App.jsx

const C = () => {
    const RenderContent = ({ initialFocusRef }) => {
        return (
            <div style={{ padding: 12 }}>
=
        <Select multiple style={{ width: '320px' }} defaultValue={['abc','hotsoon']}>
            <Select.Option value='abc'>抖音</Select.Option>
            <Select.Option value='hotsoon'>火山</Select.Option>
            <Select.Option value='jianying'>剪映</Select.Option>
            <Select.Option value='xigua'>西瓜视频</Select.Option>
        </Select>
            </div>
        );
    };

    return (
        <Popover content={<RenderContent />} trigger="click">
            <Button>click me</Button>
        </Popover>
    );
};

Additional information 补充说明

pointhalo commented 2 years ago

问题原因

由于 #593 的修改里,将Tooltip的clickOutSide监听事件由 click -> mousedown,并且加了 capture:true,所以导致 Select 传给它所使用的Popover的 stopPropagation的不生效了(因为 mouseDown的触发会先于 click,并且这里还加了capture)

pointhalo commented 2 years ago

v2.10.1