Tencent / Tencent/tdesign-react

[Select] 下拉选项的宽度,没有随着视窗的宽度变化而变化

Open
#3,858 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

💪🏻 enhancement
Dominant language
TypeScript
Stars
965
Forks
373
Avg merge
3d 6h
Merged PRs (30d)
17

Description

tdesign-react 版本

1.15.3

重现链接

https://codesandbox.io/p/devbox/jm4gky

重现步骤
import { useState } from "react";
import { Button, Dialog, Form, Row, Col, Input, Select } from "tdesign-react";

function App() {
  const [visible, setVisible] = useState(false);
  const { FormItem, useForm } = Form;
  const [form] = useForm();
  const options = [
    {
      label: "苹果",
      value: "apple",
    },
    {
      label: "香蕉",
      value: "banana",
    },
  ];

  const colSpan = {
    xs: 12,
    sm: 12,
    md: 6,
    lg: 6,
    xl: 4,
    xxl: 4,
  };

  return (
    <div>
      <Button
        onClick={() => {
          form.reset();
          setVisible(true);
        }}
      >
        打开弹窗
      </Button>
      <Dialog visible={visible} onClose={() => setVisible(false)}>
        <Form form={form}>
          <Row gutter={[16, 16]}>
            <Col {...colSpan}>
              <FormItem name="item1">
                <Input clearable />
              </FormItem>
            </Col>
            <Col {...colSpan}>
              <FormItem name="item2">
                <Input clearable />
              </FormItem>
            </Col>
            <Col {...colSpan}>
              <FormItem name="item3">
                <Input clearable />
              </FormItem>
            </Col>
            <Col {...colSpan}>
              <FormItem name="item4">
                <Select options={options} clearable />
              </FormItem>
            </Col>
            <Col {...colSpan}>
              <FormItem name="item5">
                <Select options={options} clearable />
              </FormItem>
            </Col>
          </Row>
        </Form>
      </Dialog>
    </div>
  );
}

export default App;

期望结果

Select 组件下拉选项宽度,可以随着视窗的宽度变化而变化

实际结果

Select 组件下拉选项宽度,没有随着视窗的宽度变化而变化

框架版本

React(19.0.0)

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明
Image Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the linked CodeSandbox with the provided Dialog, Form, Row, Col, Input, and Select example, then inspect the Select dropdown behavior as the viewport changes. Done means the dropdown width updates with the responsive layout and remains correct at the demonstrated viewport sizes.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.