-
Notifications
You must be signed in to change notification settings - Fork 14k
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(column-header-tooltip): make that hide the tooltip when the cloum… #18988
fix(column-header-tooltip): make that hide the tooltip when the cloum… #18988
Conversation
…n header is turncated
Codecov Report
@@ Coverage Diff @@
## master #18988 +/- ##
=======================================
Coverage 66.52% 66.52%
=======================================
Files 1714 1715 +1
Lines 65033 65038 +5
Branches 6717 6718 +1
=======================================
+ Hits 43261 43266 +5
Misses 20065 20065
Partials 1707 1707
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
/testenv up |
@rusackas Ephemeral environment spinning up at http://52.12.207.55:8080. Credentials are |
@@ -95,6 +100,7 @@ const StyledFilterableTable = styled.div` | |||
|
|||
// when more than MAX_COLUMNS_FOR_TABLE are returned, switch from table to grid view | |||
export const MAX_COLUMNS_FOR_TABLE = 50; | |||
export const MAX_COLUMN_WIDTH = 200; |
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.
@rusackas was this decided somewhere as a breakpoint?
If not, @prosdev0107 consider using this if possible, which is a dynamic way of doing it.
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.
@diegomedina248 Evan's correct handle is @rusackas
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.
@michael-s-molina crap 🤦 , 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.
THANK YOU. I spent a few minutes trying to find an example of the AntD-native approach. I swear I had a CodePen example of this that I once wrote up, but I seem to have left it in my other coat.
The 200px is indeed arbitrary. It also doesn't seem to matter, thus my comment/screenshot above.
I'm OK with setting a reasonable maximum column width. Exactly how wide is up for grabs. Maybe @kasiazjc has opinions on the matter. We should also test/consider how the contents of the cell are wrapped/truncated when hitting this maximum width.
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.
The only downside to the AntD approach is a little more vendor lock-in, should we ever decide to change component libraries again... but it probably won't be our biggest battle then :)
The getTextDimension
approach seems like it'd work, but is slightly fragile-looking to me as a technique to start reusing in more places.
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.
Sorry for the late response, but re: columns setting max/min width can be tricky I think. To do it well we would have to go through different types of data there are in the columns and define min/max... If we would introduce max width for columns and let's say we would have 2 columns it could look weird as the table would not be stretched from left or right.
Easy solution would be to scale the column width, so depending on the width of the table all columns always have the same width 🤔 but still, lot's of edge case.
That is, if I understand the problem correctly 🙃
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.
OK, regrouping my thoughts on what's needed for this PR to be ready:
• More details in the description regarding what the problem is, and where it can be seen (I didn't realize we were talking about SQL Lab at first, which led to my feedback sending the PR on a bit of a tangent).
• Probably(?) getting rid of the max-width added... if these column headers were being truncated before, we probably don't need to add an arbitrary max width (sounds like there is one already)
• I'd much prefer to go the AntD official dynamic-tooltip route than the text-dimension-measuring route.
• Before and After screenshots/gifs/movies would really help
• Basic repro/test steps would help.
• RTL tests to make sure it works as intended, and stays that way :)
@rusackas @diegomedina248 One problem is that the column header is always set as the maximum value between header text length and row content length. Thus, the column header would be not always truncated. |
<SortIndicator sortDirection={this.state.sortDirection} /> | ||
)} | ||
</div> | ||
// <Tooltip |
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.
Delete commentes :)
); | ||
}; | ||
|
||
export default TooltipParagraph; |
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 we're going to keep this component, which has value, let's add a storybook entry for it, and at least basic unit/RTL tests.
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 the improvements. We'll follow up with tests in another PR.
@prosdev0107 can you resolve the conflicts? We'll get this merged :) |
@evans |
Please note that my handle is @rusackas. We've gotta stop spamming this other guy :) I'll review/merge asap. |
Ephemeral environment shutdown and build artifacts deleted. |
apache#18988) * fix(column-header-tooltip): make that hide the tooltip when the cloumn header is turncated * fix(column-header-tooltip): fix lint * fix(column-header-tooltip): make to dynamic tooltip header in FilterTable * fix(column-header-tooltip): make to fix the lint issue * fix(column-header-tooltip): make to remove the tooltip option * fix(column-header-tooltip): make to add test and storybook for dynamic tooltip * fix(column-header-tooltip): make to fix lint
apache#18988) * fix(column-header-tooltip): make that hide the tooltip when the cloumn header is turncated * fix(column-header-tooltip): fix lint * fix(column-header-tooltip): make to dynamic tooltip header in FilterTable * fix(column-header-tooltip): make to fix the lint issue * fix(column-header-tooltip): make to remove the tooltip option * fix(column-header-tooltip): make to add test and storybook for dynamic tooltip * fix(column-header-tooltip): make to fix lint
SUMMARY
Hide Tooltip when Column Header Isn't Truncated
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
BEFORE:
Always display the Tooltip on the column header
AFTER:
Make that hide the Tooltip when the column isn't truncated.
TESTING INSTRUCTIONS
How to reproduce issues
ADDITIONAL INFORMATION