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

[Bug]: DataGrid single-select shows useless radio button on header row #33561

Open
2 tasks done
mwiemer-microsoft opened this issue Jan 6, 2025 · 1 comment
Open
2 tasks done

Comments

@mwiemer-microsoft
Copy link

Component

DataGrid

Package version

9.56.8

React version

17.0.2

Environment

System:
    OS: Windows 11 10.0.26100
    CPU: (22) x64 Intel(R) Core(TM) Ultra 7 165H
    Memory: 16.36 GB / 31.64 GB
  Browsers:
    Edge: Chromium (131.0.2903.112)
    Internet Explorer: 11.0.26100.1882
  npmPackages:
    @fluentui/react: ^8.0.0 => 8.120.5
    @fluentui/react-components: ^9.56.8 => 9.56.8
    @fluentui/react-icons: ^2.0.258 => 2.0.258
    @types/react: ^17.0.0 => 17.0.48
    @types/react-dom: ^17.0.2 => 17.0.17
    react: ^17.0.2 => 17.0.2
    react-dom: ^17.0.2 => 17.0.2

Current Behavior

  1. Create a DataGrid with single-select behavior, as seen on Fluent UI docs site.
  2. Hover over the top-left, where a radio button for the header row would appear

A button appears, but it has no name and clicking on it does nothing

Image

Expected Behavior

No button appears, no a11y FastPass issues are logged

Reproduction

https://react.fluentui.dev/?path=/docs/components-datagrid--docs#single-select

Steps to reproduce

  1. Create a DataGrid with single-select behavior, as seen on Fluent UI docs site.
  2. Hover over the top-left, where a radio button for the header row would appear

Are you reporting an Accessibility issue?

yes

Suggested severity

Medium - Has workaround

Products/sites affected

n/a

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@mwiemer-microsoft
Copy link
Author

My specific use-case is wrapping Fluent v9 data grids, so I want to conditionally apply selectionMode and selectionCell properties. So for me, the simplest fix is:

const getSelectionCellProp = React.useCallback(
    (rowIndex) =>
        props.selectionMode
            ? {
                  selectionCell: {
                      radioIndicator: { 'aria-label': `Select row ${rowIndex + 1}` },
                      checkboxIndicator: { 'aria-label': `Select row ${rowIndex + 1}` },
                  },
              }
            : {},
    [props.selectionMode]
);

// ...

return (
    <DataGrid {...props}>
        <DataGridHeader>
            <DataGridRow {...getSelectionCellProp(-1)}>
                {/* ... */}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant