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(DataGrid): Single select should not render header selection indicator #33752

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ling1726
Copy link
Member

@ling1726 ling1726 commented Jan 31, 2025

Creates specific overrides for subtle selection in the DataGridRow styles and makes the radio input in the header disabled so that users cannot navigate to it with keyboard or screen reader

Fixes #33667
Fixes #33561

@@ -25,6 +25,7 @@ export const useDataGridRow_unstable = (props: DataGridRowProps, ref: React.Ref<
const selected = useDataGridContext_unstable(ctx => ctx.selection.isRowSelected(rowId));
Copy link
Collaborator

@fabricteam fabricteam Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵🏾‍♀️ visual regressions to review in the fluentuiv9 Visual Regression Report

Avatar Converged 2 screenshots
Image Name Diff(in Pixels) Image Type
Avatar Converged.Badge Mask RTL.chromium.png 8 Changed
Avatar Converged.badgeMask.chromium.png 3 Changed
DataGridConverged - subtle multi select 1 screenshots
Image Name Diff(in Pixels) Image Type
DataGridConverged - subtle multi select.default.chromium.png 0 Added
DataGridConverged - subtle single select 1 screenshots
Image Name Diff(in Pixels) Image Type
DataGridConverged - subtle single select.default.chromium.png 0 Added

@ling1726 ling1726 force-pushed the react-table/fix/data-grid-single-header branch from 919493c to 97a00c7 Compare January 31, 2025 12:22
@ling1726 ling1726 changed the title WIP fix: Single select should not render header selection indicator Jan 31, 2025
@ling1726 ling1726 marked this pull request as ready for review January 31, 2025 17:48
@ling1726 ling1726 requested review from a team as code owners January 31, 2025 17:48
Copy link

github-actions bot commented Jan 31, 2025

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.17 MB
292.991 kB
1.171 MB
293.128 kB
643 B
137 B
react-table
DataGrid
161.06 kB
45.718 kB
161.702 kB
45.845 kB
642 B
127 B
react-table
Table (Primitives only)
42.692 kB
13.862 kB
42.738 kB
13.864 kB
46 B
2 B
react-table
Table as DataGrid
131.895 kB
36.579 kB
131.941 kB
36.585 kB
46 B
6 B
react-table
Table (Selection only)
70.562 kB
20.007 kB
70.608 kB
20.008 kB
46 B
1 B
react-table
Table (Sort only)
69.205 kB
19.618 kB
69.251 kB
19.619 kB
46 B
1 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
69.638 kB
20.24 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
224.582 kB
64.913 kB
react-components
react-components: FluentProvider & webLightTheme
44.473 kB
14.597 kB
react-portal-compat
PortalCompatProvider
8.39 kB
2.64 kB
react-timepicker-compat
TimePicker
108.551 kB
36.094 kB
🤖 This report was generated against 0274540954f0bfade4d994c5a90d04dbc0936eff

Copy link

Pull request demo site: URL

@ling1726 ling1726 requested review from khmakoto and a team as code owners February 3, 2025 08:44
@@ -183,6 +183,20 @@ describe('DataGridRow', () => {
expect(toggleRow).toHaveBeenCalledTimes(0);
});

it('should disable selection cell input if the row is in a header and the selection mode is singe', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should disable selection cell input if the row is in a header and the selection mode is singe', () => {
it('should disable selection cell input if the row is in a header and the selection mode is single', () => {

🐱

Comment on lines +57 to +59
const isHeader = useIsInTableHeader();
const isSingleSelect = useDataGridContext_unstable(ctx => ctx.selection.selectionMode === 'single');
const isSubtle = useDataGridContext_unstable(ctx => ctx.subtleSelection);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should be moved to state as in other components

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is moved to state, the only purpose would be to increase our API surface, and pass through to this hook where it is used.

Since styles hooks are hooks, what's the consequence?

Copy link
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opacity might not be the right choice for this scenario as an item remains clickable & keeps its cursor:

2025-02-03 10 40 24

It also can get focus:

image

@ling1726
Copy link
Member Author

ling1726 commented Feb 7, 2025

opacity might not be the right choice for this scenario as an item remains clickable & keeps its cursor:

As discussed these changes are for DataGrid - updated the PR title to reflect this

@ling1726 ling1726 requested a review from layershifter February 7, 2025 09:46
@ling1726 ling1726 changed the title fix: Single select should not render header selection indicator fix(DataGrid): Single select should not render header selection indicator Feb 7, 2025
@ling1726 ling1726 closed this Feb 7, 2025
@ling1726 ling1726 reopened this Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants