-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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
fix: Dashboard Edit View Tab Headers Hidden when Dashboard Name is Long #19472
fix: Dashboard Edit View Tab Headers Hidden when Dashboard Name is Long #19472
Conversation
useEffect(() => { | ||
setBarTopOffset(headerRef.current?.getBoundingClientRect()?.height || 0); | ||
|
||
let observer: ResizeObserver; | ||
if (typeof global.ResizeObserver !== 'undefined' && headerRef.current) { | ||
observer = new ResizeObserver(entries => { | ||
setBarTopOffset( | ||
current => entries?.[0]?.contentRect?.height || current, | ||
); | ||
}); | ||
|
||
observer.observe(headerRef.current); | ||
} | ||
|
||
return () => { | ||
observer?.disconnect(); | ||
}; | ||
}, []); |
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.
Nice solution!
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.
Codecov Report
@@ Coverage Diff @@
## master #19472 +/- ##
==========================================
- Coverage 66.48% 66.42% -0.07%
==========================================
Files 1670 1673 +3
Lines 63968 64055 +87
Branches 6512 6519 +7
==========================================
+ Hits 42531 42547 +16
- Misses 19748 19817 +69
- Partials 1689 1691 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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
SUMMARY
The dashboard edit view get's cut off (hidden behind) when the dashboard header is bigger than usual.
This can happen if the dashboard title occupies more than one line, making the header bigger, or when editing the title.
The reason is because the edit view is sticky, and the top is hardcoded.
This PR calculates the top offset of the edit view based on the dashboard header view, so that it looks correctly regardless of size.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
Screen.Recording.2022-03-31.at.15.10.51.mov
After:
new.mov
TESTING INSTRUCTIONS
Ensure the edit view tabs are still visible.
ADDITIONAL INFORMATION