carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.86k stars 1.82k forks source link

[CodeSnippet]: several enhancements and bugs #7551

Closed guigueb closed 1 year ago

guigueb commented 3 years ago

IBM Cognos has ran into several issues with CodeSnippet.

I've tried to capture them all, so we can discuss what to do. I am not guaranteeing that I got all the issues. For reference these are also tracked in https://jsw.ibm.com/browse/MUI-1316.

This Jira is happening because of imitations/bugs in Carbon CodeSnippet.

When the contents overflow the size of a single line Carbon CodeSnippet (type="single")...

The contents will scroll horizontally and a scroll bar will show. As this is a single line no vertical scroll is needed (newlines are removed and all the lines are concatenated into one long string). Single is easy and works.

When the contents overflow the size of a multi line Carbon CodeSnippet (type="multi")...

The multi-line CodeSnippet is always expandable - ie: the showMoreText / showMoreText will always be present. An enhancement https://github.com/carbon-design-system/carbon/issues/7579 to disable the use of showMoreText / showMoreText, and allow scrolling, should be logged.

If the content is less than 15 rows (the CodeSnippet grows to show up to 14 rows)... An enhancement https://github.com/carbon-design-system/carbon/issues/7579 to set the number of rows when in closed form (the 'Show more' button is visible) should be logged.

If the contents overflows the width...

If the content is exactly 15 rows (the CodeSnippet grows to show up to 15 rows)...

If the contents overflows the width...

The 'Show more' button shows...

When in short form (the 'Show more' button is visible)... An enhancement https://github.com/carbon-design-system/carbon/issues/7579 to set the number of rows when in closed form (the 'Show more' button is visible) should be logged.

If the contents overflows the width...

If the contents overflows the height...

When in long form (the 'Show less' button is visible)... The CodeSnippet grows to show the total number of rows available. An enhancement https://github.com/carbon-design-system/carbon/issues/7579 to set the number of rows when in expanded form (the 'Show more' button is visible) should be logged.

If the contents overflows the width...

If the contents can be scrolled vertically

If the CodeSnippet is constrained by a parents width/height and/or the Carbon CodeSnippet is styled with a height and/or width... The CodeSnippet does not adopt to fit nicely.

guigueb commented 3 years ago

I logged a bug to deal with the showMore button showing when there are exactly 15 rows. https://github.com/carbon-design-system/carbon/issues/7572

guigueb commented 3 years ago

I logged a bug to deal with the horizontal scrollbar not showing when type is multi and there is a long row of data https://github.com/carbon-design-system/carbon/issues/7574

guigueb commented 3 years ago

I have logged an enhancement to set the closed and expanded number of rows https://github.com/carbon-design-system/carbon/issues/7579

tw15egan commented 3 years ago

@guigueb I've converted this issue into an epic so that we can make sure we properly keep track of all the bugs/enhancements you've described. Let me know if I've missed any and I can add them to the epic:

sstrubberg commented 1 year ago

Closing this issue as it looks like most of it has been handled and the remaining piece is being tracked in https://github.com/carbon-design-system/carbon/issues/7574