-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add css rule to keep header visible when maxHeight is set #3166
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
Conversation
d248a51 to
643645f
Compare
There was a problem hiding this 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 => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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({}); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
…eact-spectrum into make-async-tableheader-visible
There was a problem hiding this 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!!
There was a problem hiding this 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!
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:
📝 Test Instructions:
packages/@react-spectrum/table/stories/Table.stories.tsxon line 157 to change theheightprop tomaxHeight.