Skip to content

Conversation

@ihgrant
Copy link
Contributor

@ihgrant ihgrant commented May 26, 2022

Closes #3159

I added a Chromatic story to illustrate the fix - haven't used Chromatic or Storybook before so let me know if I did something wrong!

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

  • on this branch, run the storybook and modify packages/@react-spectrum/table/stories/Table.stories.tsx on line 157 to change the height prop to maxHeight.
  • verify that the header is fully visible in the "dynamic" TableView story

@ihgrant ihgrant force-pushed the make-async-tableheader-visible branch from d248a51 to 643645f Compare May 26, 2022 22:08
Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

Thanks for submitting a fix! couple small notes

heads up, I did merge in main


beforeEach(() => {
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => cb());
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => {
Copy link
Member

Choose a reason for hiding this comment

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

can we revert this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, will do.

NestedColumns.storyName = 'nested columns';
NestedColumns.args = {columns: nestedColumns, items};

export const MaxHeight = Template.bind({});
Copy link
Member

Choose a reason for hiding this comment

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

So this actually doesn't render anything
you can run our chromatic storybook if you run the command yarn start:chromatic as defined in our package.json

That aside, I don't think we really need this, we'd really need to test it against the async version to meet your reproduction from what you've said. It also looks like the Template is not applying the maxHeight where you expect.

I think it's plenty this time to just contribute the fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, despite my initial report I think this bug occurs even with non-async lists, so I'll spend a bit of time to see if I can get this working. I wasn't aware I could run Chromatic locally without a token, that should help.

So this actually doesn't render anything

Is this because I am (mistakenly) not calling Template?

Copy link
Member

@snowystinger snowystinger May 27, 2022

Choose a reason for hiding this comment

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

Honestly, I didn't dig into why it wasn't rendering anything. If it happens in the non-async case, that'd be immensely helpful. Is it easy to reproduce?

I'd check the definition of Template a little further up in the file, looks like it already has a maxHeight on the TableView. You also don't need to use the Template, you can just return a component. So if you have a reproduction case, you could just copy it in and it should work.

If this is taking too much time, I'm really ok with just the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got the Chromatic test working using a literal component which demonstrates the bug if the CSS line is commented out. Thanks for the pointers!

Copy link
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

Awesome, chromatic looks good, so it's just undoing the changes in the test file, then I can approve

Thanks!!

@snowystinger snowystinger added the small review Easy to review PR label Jun 6, 2022
Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

LGTM, tested the css change locally w/ the chromatic story. Thanks for the fix!

@LFDanLu LFDanLu merged commit a563c03 into adobe:main Jun 6, 2022
@ihgrant ihgrant deleted the make-async-tableheader-visible branch June 13, 2022 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small review Easy to review PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table header in TableView using asyncList is not visible

4 participants