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 - as attribute doesn't work on DataGridRow #30106

Closed
2 tasks done
kroudams opened this issue Dec 18, 2023 · 4 comments
Closed
2 tasks done

[Bug]: DataGrid - as attribute doesn't work on DataGridRow #30106

kroudams opened this issue Dec 18, 2023 · 4 comments

Comments

@kroudams
Copy link

Library

React Components / v9 (@fluentui/react-components)

System Info

.

Are you reporting Accessibility issue?

None

Reproduction

https://codesandbox.io/p/sandbox/condescending-browser-r8gr2y?file=%2Fsrc%2Fexample.tsx%3A9%2C16

Bug Description

Actual Behavior

When as="tr" is set on <DataGridRow as="tr"> it still renders as <div role="row">

Expected Behavior

When as="tr" is set on <DataGridRow as="tr"> it should be rendered as <tr>

image

Logs

No response

Requested priority

High

Products/sites affected

No response

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.
@micahgodbolt micahgodbolt changed the title [Bug]: as attribute with "tr" value doesn't work on DataGridRow [Bug]: DataGrid - as attribute doesn't work on DataGridRow Jan 8, 2024
@ling1726
Copy link
Member

Using native semantic table elements means that all other elements must be semantic table elements. Due to the restrictions there and the fact that DataGrid renders as role="grid", we made the decision to not allow semantic table element toggling in this component.

Is there a reason why rendering DataGrid as semantic table elements would be preferrable? The case you're drescribing now should not be supported since you would be rendering tr for rows but div for everything else

@kroudams
Copy link
Author

tr was an example. I wanted to use DataGrid as it already has all the functionality built-in (e.g. sorting).

@ling1726
Copy link
Member

What should the end result look like? do you expect the DataGrid to render completely with semantic table elements? (tbody, tr, td etc...?)

The DataGrid by default does not use semantic elements, because it needs to be a role="grid" for screen reader narration, because tables should not have keyboard navigation/selection semantics. Even if the DataGrid rendered semantic table elements the default roles would need to be override to the grid variants so there's no real benefit I can see of using semantic table elements.

Because this issue is marked as by design and has not had activity for over 3 days, we're automatically closing it for house-keeping purposes.

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

3 participants