idux
idux copied to clipboard
[IxCheckbox] 复选框下嵌套下拉多选组件时,点选下拉组件的非选择框区域,选择框的勾选状态不会发生改变。
- [x] I have searched the issues of this repository and believe that this is not a duplicate.
Reproduction link
Steps to reproduce
如上述复现链接,在下拉框内点选非选择框区域来进行选项的选择。
What is expected?
选择框的勾选状态能正常联动。
What is actually happening?
选择框的勾选状态没有联动。
Environment Info
Any additional comments? (optional)
问题原因是packages/components/checkbox/src/Checkbox.tsx第 53 行,通过 inject 来判断当前的 checkbox 父组件是否是 checkboxGroup。
但如果任意一级的祖先组件是 checkboxGroup 就会导致 inject 有误,随后导致 180 行判断有误,accessor 从祖先级别的 checkboxGroup 获取,导致 此 bug。
@liuzaijiang @sallerli1 是不是可以在 Select 组件类手动注入下 CheckboxGroupToken 为 null ? 避免这种嵌套用法的时候,误拿了上层的 token,
Radio 组件也是一样的。