-
Notifications
You must be signed in to change notification settings - Fork 843
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
Allow EuiDataGrid's default column width to update on resize #2991
Allow EuiDataGrid's default column width to update on resize #2991
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_2991/ |
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.
I'm ok with the approach. It'd be cooler if the observer components were based on shareable hooks and not classes, but I understand modification here
Definitely felt the same as I was putting this together. I'll see what I can do! |
240b530
to
b3bc695
Compare
@@ -150,6 +150,7 @@ export class EuiDataGridCell extends Component< | |||
if (nextProps.visibleRowIndex !== this.props.visibleRowIndex) return true; | |||
if (nextProps.colIndex !== this.props.colIndex) return true; | |||
if (nextProps.columnId !== this.props.columnId) return true; | |||
if (nextProps.columnType !== this.props.columnType) return true; |
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.
If only React had a way to specify dependencies that also included an ESLint rule to tell you when you're missing one. Oh wait ... 😅
Maybe someday this'll be a function component with hooks.
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.
Didn't dig into the code much, just a passing glance, but didn't see anything that would impact the component API or the accessibility so signing off on it.
Will let @thompsongl be the code eyes 🙂
@thompsongl refactored everything to be much nicer, updated PR description with more info. |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2991/ |
src/components/observer/resize_observer/resize_observer.test.tsx
Outdated
Show resolved
Hide resolved
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.
I don't have an answer for this and don't consider it a blocker. Just showing it in case anyone has any ideas on how to avoid the "jump". I realize I am a picky designer for even pointing it out. I may or may have recorded a video of this to make sure I wasn't seeing things, which might tell you about how small this issue is 🤣
Ultimately this is a much better tradeoff than what existed before. Tested for functionality and acts how I'd expect.
@snide nice catch! Pushed an update to fix that flash |
Preview documentation changes for this PR: https://eui.elastic.co/pr_2991/ |
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!
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.
Yesss! Thank you for the fix. Confirmed locally.
Preview documentation changes for this PR: https://eui.elastic.co/pr_2991/ |
Summary
Fixes #2759
Problem & reproduction
When originally debugging the issue where datagrid's columns weren't sized correctly on page load, I noticed that at the initial mount, its wrapping flex row wasn't at the full size - only later did it expand to fit available space. I was able to replicate this kind of behaviour in the EUI docs by:
Fix
useResizeObserver
hook w/documentation & hookuseResizeObserver
to fix the source bug in data gridOther bug
In testing this across browsers, I found that IE11 + Safari (the two remaining with no
ResizeObserver
support) don't trigger the mutation observer fallback, as the content isn't mutated. This should be fixed separately, as it is a bug within theResizeObserver
fallback. I've created #3044 to track this.Checklist
- [ ] Check against all themes for compatibility in both light and dark modes- [ ] Props have proper autodocs- [ ] Added documentation examples- [ ] Added or updated jest tests- [ ] Checked for accessibility including keyboard-only and screenreader modes