From 9c884045131d0bba6e4e201d670fae84b41e697f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 4 Aug 2026 15:02:37 +0800 Subject: [PATCH 1/3] test: reproduce disabled child selection issue --- tests/Select.checkable.spec.tsx | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/tests/Select.checkable.spec.tsx b/tests/Select.checkable.spec.tsx index 2e5a427c..646c608d 100644 --- a/tests/Select.checkable.spec.tsx +++ b/tests/Select.checkable.spec.tsx @@ -789,6 +789,71 @@ describe('TreeSelect.checkable', () => { expect(document.querySelector('.rc-tree-select-tree-treenode-checkbox-checked')).toBeTruthy(); }); + it('should keep disabled child selected when checking its parent', () => { + const treeData = [ + { + title: 'Node1', + value: '0-0', + key: '0-0', + children: [ + { + title: 'Child Node1', + value: '0-0-0', + key: '0-0-0', + }, + ], + }, + { + title: 'Node2', + value: '0-1', + key: '0-1', + children: [ + { + title: 'Child Node3', + value: '0-1-0', + key: '0-1-0', + disabled: true, + }, + { + title: 'Child Node4', + value: '0-1-1', + key: '0-1-1', + }, + { + title: 'Child Node5', + value: '0-1-2', + key: '0-1-2', + }, + ], + }, + ]; + + const App = () => { + const [value, setValue] = React.useState(['0-1-0']); + + return ( + + ); + }; + + const { container } = render(); + + selectNode(2); + + expect(getSelections(container)).toHaveLength(2); + expect([getSelectionText(container, 0), getSelectionText(container, 1)]).toEqual( + expect.arrayContaining(['Node2', 'Child Node3']), + ); + }); + // https://github.com/ant-design/ant-design/issues/32184 it('should pass correct keys', () => { const { rerender } = render( From 412cc9bf34835f3e1efe56686414c63407187163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 4 Aug 2026 15:03:21 +0800 Subject: [PATCH 2/3] fix: preserve disabled child selection --- src/utils/strategyUtil.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/utils/strategyUtil.ts b/src/utils/strategyUtil.ts index 699e59ff..5bcb5ac7 100644 --- a/src/utils/strategyUtil.ts +++ b/src/utils/strategyUtil.ts @@ -33,7 +33,12 @@ export function formatStrategyValues( return values.filter(key => { const entity = keyEntities[key]; const parent = entity ? entity.parent : null; - return !parent || isCheckDisabled(parent.node) || !valueSet.has(parent.key as SafeKey); + return ( + !parent || + isCheckDisabled(entity.node) || + isCheckDisabled(parent.node) || + !valueSet.has(parent.key as SafeKey) + ); }); } return values; From b7c7af10e02688fe7c1549844a083bb0633f3343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Tue, 4 Aug 2026 15:39:43 +0800 Subject: [PATCH 3/3] chore: refresh pull request checks