Skip to content
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

[Bug]: Nothing happen when I clicked on "Show more" in <CodeSnippet> component. #15774

Closed
2 tasks done
gayatri2023 opened this issue Feb 16, 2024 · 5 comments · Fixed by #15839
Closed
2 tasks done

[Bug]: Nothing happen when I clicked on "Show more" in <CodeSnippet> component. #15774

gayatri2023 opened this issue Feb 16, 2024 · 5 comments · Fixed by #15839

Comments

@gayatri2023
Copy link

gayatri2023 commented Feb 16, 2024

Package

@carbon/react

Browser

Chrome

Package version

v1.49.0

React version

v17.0.2

Description

The Show more button does not cause the windows to enlarge when the string is sufficiently short. The Show more button functions when the string is longer. It appears that there is a calculation error with the Show more button.

Reproduction/example

https://stackblitz.com/edit/github-kjuqye?file=src%2FApp.jsx

Steps to reproduce

Create a multiline code snippet with sufficiently short string and try to click on Show more button. We noticed this in Windows Chrome environment.

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

No response

Code of Conduct

@tw15egan
Copy link
Collaborator

@gayatri2023 can you explain the issue a bit more? The Show More button will only expand the content area of the CodeSnippet; it will not make the browser window any larger. In your example, there is only 1 line of whitespace to expand to, so it just expands so that you do not need to scroll to see the whitespace at the end.

@gayatri2023
Copy link
Author

Hi @tw15egan
To understand the issue clearly, could you please run the code snippet in Windows - Chrome and Mac - Chrome environments. You will be able to see the difference of CodeSnippet component performance.

@gayatri2023
Copy link
Author

FYR, Issue in Windows - Chrome environment.

Screenshare.-.2024-02-21.11_22_07.AM.mp4

@markfarkas-camunda
Copy link

I also encountered this bug, and I can reproduce this on Windows 11 using Chrome 121.
Package version: v1.50.0, React version: v18.2.0
Example code: https://stackblitz.com/edit/github-aoabhq-pwfhgb?file=src%2FApp.jsx

@markfarkas-camunda
Copy link

The workaround for me was setting the value of minExpandedNumberOfRows property to zero (minExpandedNumberOfRows={0}). The default value of this property is 16, and for some reason this means if you don't have at least 16 lines of text, the CodeSnippet will collapse automatically. If this is intended please clarify the behavior in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants