react-component / react-component/select

SelectTrigger dropdownMatchSelectWidth 属性的使用逻辑有问题,个人要Safari浏览器有Bug,antd Calendar的年份和月份的下拉选择列表显示不完整

Open
#334 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
938
Forks
482
Avg merge
15h 8m
Merged PRs (30d)
2

Description

@sorrycc @yiminghe @ocha
SelectTrigger dropdownMatchSelectWidth 属性的使用逻辑有问题,Safari浏览器在测试使用antdesign(3.10.2)的 Calendar组件时年份和月份的下拉选择列表显示不完整。

image

经查,问题出现在下面:
SelectTrigger.jsx 73行至81行
setDropdownWidth = () => { if (!this.props.dropdownMatchSelectWidth) { return; } // 修复这个bug, 这句判断应去掉 const width = ReactDOM.findDOMNode(this).offsetWidth; if (width !== this.state.dropdownWidth) { this.setState({ dropdownWidth: width }); } }
与SelectTrigger.jsx 159行至161行
if (this.state.dropdownWidth) { popupStyle[widthProp] = ${this.state.dropdownWidth}px; } 的逻辑冲突,导致dropdownMatchSelectWidth为false时,逻辑不正确,不能正确设置下拉列表宽度,dropdownMatchSelectWidth为true时,重复的判断。
初步学习react,经过个人测试,删除74至76行判断逻辑即可。不知修复方法是否妥当?

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the Safari Calendar year and month dropdown issue, then inspect SelectTrigger.jsx lines 73–81 and 159–161. Compare the width behavior with dropdownMatchSelectWidth set to true and false, and verify that both dropdowns display completely after the change.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.