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

Table: Allow specifying an id for 'select all' checkbox #7500

Open
kraine93 opened this issue Dec 10, 2024 · 1 comment
Open

Table: Allow specifying an id for 'select all' checkbox #7500

kraine93 opened this issue Dec 10, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@kraine93
Copy link

Provide a general summary of the feature here

Currently in every Table with selection, the 'select all' checkbox is given a random key. This is breaking snapshot tests as the id is generated each time the test runs, and it also means that we can't use the id as a selector in test automation.

🤔 Expected Behavior?

If we can specify a key, this would be used to override the generated one so that we can have consistent output in our tests.

😯 Current Behavior

A new key is generated on every test run, and there is no way to override it.

💁 Possible Solution

I found where in the code that the key is set: TableCollection.ts

This is called from the constructor of useTableState: useTableState.ts

Perhaps we could pass a prop in TableStateProps the same way that we pass showSelectionCheckboxes - this would be passed down in the context and then used when creating the selection column.

🔦 Context

This issue means that we can't write snapshot tests for Table components or pages that use a Table, and it also means we can't use the id as a selector in test automation.

💻 Examples

No response

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@LFDanLu
Copy link
Member

LFDanLu commented Dec 11, 2024

Possible that the check here

let prefix = didSSR || process.env.NODE_ENV === 'test' ? 'react-aria' : `react-aria${defaultContext.prefix}`;
is being compiled away, we'll have to look into making sure it isn't.

@LFDanLu LFDanLu added the bug Something isn't working label Dec 11, 2024
@LFDanLu LFDanLu moved this from 🩺 To Triage to ✏️ To Groom in RSP Component Milestones Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: ✏️ To Groom
Development

No branches or pull requests

2 participants