Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix(TableSelectionCell): Radios should not change selection on focus",
"packageName": "@fluentui/react-table",
"email": "lingfangao@hotmail.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { render } from '@testing-library/react';
import { resetIdsForTests } from '@fluentui/react-utilities';
import { TableSelectionCell } from './TableSelectionCell';
import { isConformant } from '../../testing/isConformant';
import { TableSelectionCellProps } from './TableSelectionCell.types';
Expand All @@ -10,6 +11,7 @@ const tr = document.createElement('tr');
describe('TableSelectionCell', () => {
beforeEach(() => {
document.body.appendChild(tr);
resetIdsForTests();
});

isConformant({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`TableSelectionCell renders a default state 1`] = `
>
<input
class="fui-Checkbox__input"
id="checkbox-9"
id="checkbox-2"
type="checkbox"
/>
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { resolveShorthand } from '@fluentui/react-utilities';
import { resolveShorthand, useId } from '@fluentui/react-utilities';
import { Checkbox } from '@fluentui/react-checkbox';
import { Radio } from '@fluentui/react-radio';
import type { TableSelectionCellProps, TableSelectionCellState } from './TableSelectionCell.types';
Expand Down Expand Up @@ -36,7 +36,7 @@ export const useTableSelectionCell_unstable = (
}),
radioIndicator: resolveShorthand(props.radioIndicator, {
required: type === 'radio',
defaultProps: { checked: !!checked },
defaultProps: { checked: !!checked, input: { name: useId('table-selection-radio') } },
}),
type,
checked,
Expand Down