Skip to content

Tabs搭配select出现样式异常 #35136

@LL1314520

Description

@LL1314520

Reproduction link

https://stackblitz.com/edit/fqjvgl--run?file=index.js

Steps to reproduce

antd的Tabs组件结合Select组件使用时,将Select组件设置getPopupContainer={el => el.parentNode},Select挂载异常,没有挂载到select下而是挂载到了tabs下面,下面是代码:

import React from 'react';
import ReactDOM from 'react-dom';
import 'antd/dist/antd.css';
import './index.css';
import { Tabs,Select } from 'antd';

const { TabPane } = Tabs;
const { Option } = Select

function callback(key) {
  console.log(key);
}

ReactDOM.render(
  <div>
  <Tabs defaultActiveKey="1" onChange={callback}>
  <TabPane tab="Tab 1" key="1">
    <Select defaultValue="lucy" style={{ width: 120 }} getPopupContainer={el => el.parentNode} >
      <Option value="jack">Jack</Option>
      <Option value="lucy">Lucy</Option>
      <Option value="disabled" disabled>
        Disabled
      </Option>
      <Option value="Yiminghe">yiminghe</Option>
  </Select>
  </TabPane>
  <TabPane tab="Tab 2" key="2">
    Content of Tab Pane 2
  </TabPane>
  <TabPane tab="Tab 3" key="3">
    Content of Tab Pane 3
  </TabPane>
</Tabs>
</div>,
  document.getElementById('container'),
);

What is expected?

select能够挂载到正确位置

What is actually happening?

下拉框挂载到了tabs下面

Environment Info
antd 4.19.5
React 18
System mac最新版本
Browser chrome最新版本

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions