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: Select use value width instead of default fixed width #20538

Merged
merged 4 commits into from Dec 30, 2019

Conversation

zombieJ
Copy link
Member

@zombieJ zombieJ commented Dec 30, 2019

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / document update
  • Component style update
  • TypeScript definition update
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

fix #20394

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Select width not follow value width
🇨🇳 Chinese

☑️ Self Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@zombieJ zombieJ changed the title [WIP] Select use value width instead of default fixed width [WIP] fix: Select use value width instead of default fixed width Dec 30, 2019
@auto-add-label auto-add-label bot added the bug label Dec 30, 2019
@netlify
Copy link

netlify bot commented Dec 30, 2019

Deploy preview for ant-design ready!

Built with commit 9ed5b7e

https://deploy-preview-20538--ant-design.netlify.com

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 30, 2019

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 9ed5b7e:

Sandbox Source
antd reproduction template Configuration

@zombieJ
Copy link
Member Author

zombieJ commented Dec 30, 2019

Chrome 的对齐挺玄学的,给个参照物就全对了:
Kapture 2019-12-30 at 17 28 17

@codecov
Copy link

codecov bot commented Dec 30, 2019

Codecov Report

Merging #20538 into 4.0-prepare will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##           4.0-prepare   #20538   +/-   ##
============================================
  Coverage        97.56%   97.56%           
============================================
  Files              295      295           
  Lines             6771     6771           
  Branches          1831     1869   +38     
============================================
  Hits              6606     6606           
  Misses             165      165

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ab71f8...9ed5b7e. Read the comment docs.

@zombieJ zombieJ changed the title [WIP] fix: Select use value width instead of default fixed width fix: Select use value width instead of default fixed width Dec 30, 2019
@zombieJ
Copy link
Member Author

zombieJ commented Dec 30, 2019

Will create another PR to fix Chrome align.

&::after,
.@{select-prefix-cls}-selection-placeholder::after {
line-height: @select-height-without-border;
content: '\a0';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\a0 是啥?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空字符,同下用来 baseline align 占位用的。


&::after,
.@{select-prefix-cls}-selection-placeholder::after {
line-height: @select-height-without-border;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该不需要。

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

没有文字的时候 baseline align 会错位,需要一个带 line-height 的元素 align 一下。

@afc163
Copy link
Member

afc163 commented Dec 30, 2019

border-top-width: @border-width-base + 0.02px;

测试了一下 4.0 的样式里这个对齐的 magic number 变成了 border-top-width: 1.375px;

@zombieJ
Copy link
Member Author

zombieJ commented Dec 30, 2019

先用 magic number align 一下,之后开个新的 PR 整体调一下。以后都以 span align 为准:

<span style={{ lineHeight: 32 }}>
  233
</span>

@afc163
Copy link
Member

afc163 commented Dec 30, 2019

不一定有 line-height,也可以以 <span>xxx</span> 为准。

@zombieJ
Copy link
Member Author

zombieJ commented Dec 30, 2019

不一定有 line-height,也可以以 <span>xxx</span> 为准。

这两个是配合的:

content: '\a0';
line-height: @select-height-without-border;

@afc163
Copy link
Member

afc163 commented Dec 30, 2019

    content: '\a0';
 -  line-height: @select-height-without-border;

貌似不需要这个也能对齐。

@zombieJ
Copy link
Member Author

zombieJ commented Dec 30, 2019

重现不出来了,我也不知道为啥这么写了。删了。

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

Successfully merging this pull request may close these issues.

None yet

2 participants