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(dialog): resolve styledProps pass frame wrong #2639

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

NWYLZW
Copy link
Collaborator

@NWYLZW NWYLZW commented Dec 3, 2023

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

#2619

💡 需求背景和解决方案

Dialog 组件的 className 存在实现问题,导致其会被挂在到多个节点。

📝 更新日志

  • fix(Dialog): 修复了 Dialog 的 className 进行的多次节点挂载错误,className 将仅被挂载至 ctx 元素上。
  • feat(Dialog): 添加了 dialogClassName 用于处理内部 dialog 节点样式。建议之前通过 className 直接修改弹窗本体样式的用户切换使用为 dialogClassName

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link
Contributor

github-actions bot commented Dec 3, 2023

完成

@NWYLZW
Copy link
Collaborator Author

NWYLZW commented Dec 3, 2023

这个目前来说如果加上了一个新的 dialogClassName 在 props ,则会导致俩部分的交互产生割裂,具体如下:

  • 目前 className 会被默认挂载到 ctx 元素上
    <div
    ref={wrapRef}
    className={classNames(props.className, `${componentCls}__ctx`, `${componentCls}__${mode}`, {
    [`${componentCls}__ctx--fixed`]: !showInAttachedElement,
    [`${componentCls}__ctx--absolute`]: showInAttachedElement,
    })}
    style={{ zIndex }}
    onKeyDown={handleKeyDown}
    tabIndex={0}
  • 目前 style 会被挂载到 dialog 元素上
    <DialogCard
    ref={dialogCardRef}
    {...restState}
    style={{ ...style, width: parseValueToPx(width || style?.width) }}

如果按照这个方式进行修复,则会出现:

className 在 ctx 上,dialogClassName 和 style 在 dialog 上,className 与对应的 style 的并不统一了。
或许我们需要一个 dialogStyle,但是这样看起来 breaking 的稍微有点大了。

所以我还是比较偏向于将 className 下放到对应的 dialog 上,而不是 ctx,放在 ctx 来说是一种相对来说错误的实现。

@NWYLZW NWYLZW changed the title fix(radio): group can't render outline variant by options prop fix(dialog): resolve styledProps pass frame wrong Dec 3, 2023
@NWYLZW NWYLZW force-pushed the fix/dialog/resolve-styledProps-pass-frame-wrong branch from 31be7a8 to 347c40b Compare January 11, 2024 06:55
@NWYLZW NWYLZW marked this pull request as ready for review January 11, 2024 06:59
@NWYLZW NWYLZW merged commit 208118d into develop Jan 11, 2024
5 checks passed
@NWYLZW NWYLZW deleted the fix/dialog/resolve-styledProps-pass-frame-wrong branch January 11, 2024 07:18
@github-actions github-actions bot mentioned this pull request Jan 11, 2024
16 tasks
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.

2 participants