-
-
Notifications
You must be signed in to change notification settings - Fork 49.8k
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(badge): fix badge number is rtl #43998
Conversation
Run & review this pull request in StackBlitz Codeflow. |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
I forgot to update the snapshots, fixed. |
第一次见这个标签,长姿势了 |
话说这个不会影响到正常模式吧? |
不会吧,就只是和 |
@afc163 这个 dom 结构变了,算不算 break change?是不是得发到 feature 分支? |
加个 |
css 的 不过也许不会有 rtl 的内容? 之前试过 |
加一些用例看看么,bdi 如果合适的话可以把 span 替换掉 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #43998 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 659 659
Lines 11200 11200
Branches 3033 3033
=========================================
Hits 11200 11200
☔ View full report in Codecov by Sentry. |
是要什么样的用例呢
|
主要是这个,bdi 应该是对整个 children 生效的,所以实际上和加 |
bdi 只是隔离文本方向让浏览器对 bdi 里面的元素重新计算,里面也可能会有 rtl 的内容,那样感觉 |
用 然后就在 把 badge 最外层的 加一层 感觉这么说有点不是很直观……我把给改完但是有点问题的 push 上来? |
我明白了。 |
components/badge/ScrollNumber.tsx
Outdated
@@ -79,7 +79,7 @@ const ScrollNumber = React.forwardRef<HTMLElement, ScrollNumberProps>((props, re | |||
|
|||
return ( | |||
<Component {...newProps} ref={ref}> | |||
{numberNodes} | |||
<bdi>{numberNodes}</bdi> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
要兼容 IE 的话 dir="auto"
也是不能使用的就只能 direction: ltr
,这样就需要假设 badge 里面的内容只会是 LTR 的了
#43991 感觉也可以用这个解法,给 rtl 模式下内部的数字设置一个 |
感觉 bdi 语义上明确一点,稍微差一点就是 |
|
我晚上搞一下 |
直接改 ScrollNumber 的 style 就可以了吧 |
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
close #43971
💡 Background and solution
Number in badge is right-to-left if direction of the page is RTL, e.g.
25
displays as52
,999+
displays as+999
.Wrap the number with a
<bdi>
to fix it.📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
🤖 Generated by Copilot at 826024d
Wrap badge numbers in
<bdi>
element to preserve their directionality in different languages. Improve internationalization ofcomponents/badge/ScrollNumber.tsx
.🔍 Walkthrough
🤖 Generated by Copilot at 826024d
<bdi>
element to prevent directionality issues in some languages (link)