Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dont scrollIntoView when options length changed #984

Closed
wants to merge 1 commit into from

Conversation

littleee
Copy link

@littleee littleee commented Oct 11, 2023

fixed #982

@vercel
Copy link

vercel bot commented Oct 11, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
select ❌ Failed (Inspect) Oct 11, 2023 11:49am

@codecov
Copy link

codecov bot commented Oct 11, 2023

Codecov Report

Merging #984 (fa87050) into master (d5442ba) will not change coverage.
The diff coverage is n/a.

❗ Current head fa87050 differs from pull request most recent head eaa891b. Consider uploading reports for the commit eaa891b to get more accurate results

@@           Coverage Diff           @@
##           master     #984   +/-   ##
=======================================
  Coverage   99.78%   99.78%           
=======================================
  Files          38       38           
  Lines        1373     1373           
  Branches      393      375   -18     
=======================================
  Hits         1370     1370           
  Misses          3        3           
Files Coverage Δ
src/OptionList.tsx 99.33% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@yoyo837
Copy link
Member

yoyo837 commented Oct 12, 2023

长度不变内容变了呢?

@littleee
Copy link
Author

长度不变内容变了呢?

给个场景? 内容变指的是searchValue吗? searchValue变了保持原逻辑不就可以吗?

@yoyo837
Copy link
Member

yoyo837 commented Oct 12, 2023

flattenOptions 长度不变内容变时

@littleee
Copy link
Author

littleee commented Oct 12, 2023

flattenOptions 长度不变内容变时

我个人理解哈, 本次改动并不会对 长度不变内容变 这种情况造成影响,还是和原逻辑一致。 当前改动只是去掉了flattenOptions.length的监听。
我写了个demo验证了一下原逻辑和改动后的逻辑是保持一致的,均不会跳转到active项

@afc163
Copy link
Member

afc163 commented Oct 13, 2023

这个删掉会不会导致原问题还出现 ant-design/ant-design#40625

@littleee
Copy link
Author

这个删掉会不会导致原问题还出

ant-design/ant-design#40625 这个issue里面关联的pr并没有解决掉该issue的问题, 40625的问题依然存在。
看了下代码, 没有第一次没有出现滚动条的原因是因为rc-virtual-list组件里面有两个属性 listItemHeightlistHeight,默认值分别为200和20, 也就是说只有当item大于10个的时候才会出现滚动条。 之所以能滚动是因为item现在是24px的高度, 然后rc-virtual-list是按照20计算的, 所以就导致了超出了列表的高度但是没有滚动条。
anyway...
显然这是另一个问题了, 与当前pr无关。 下图可以看到,最新antd版本第一次打开依然没有滚动条
image

@yoyo837
Copy link
Member

yoyo837 commented Oct 17, 2023

Close by #986

@yoyo837 yoyo837 closed this Oct 17, 2023
@littleee
Copy link
Author

lol

Close by #986

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants