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

fix(code-snippet): scrollbar not clickable on muliline #12605

Merged
merged 2 commits into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/react/src/components/CodeSnippet/CodeSnippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ function CodeSnippet({
[`${prefix}--snippet--light`]: light,
[`${prefix}--snippet--no-copy`]: hideCopyButton,
[`${prefix}--snippet--wraptext`]: wrapText,
[`${prefix}--snippet--has-right-overflow`]:
type == 'multi' && hasRightOverflow,
});

const expandCodeBtnText = expandedCode ? showLessText : showMoreText;
Expand Down Expand Up @@ -243,7 +245,7 @@ function CodeSnippet({
{hasLeftOverflow && (
<div className={`${prefix}--snippet__overflow-indicator--left`} />
)}
{hasRightOverflow && (
{hasRightOverflow && type !== 'multi' && (
<div className={`${prefix}--snippet__overflow-indicator--right`} />
)}
{!hideCopyButton && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,15 @@ $copy-btn-feedback: $background-inverse !default;
overflow-x: auto;
}

.#{$prefix}--snippet--multi .#{$prefix}--snippet-container pre::after {
.#{$prefix}--snippet--multi.#{$prefix}--snippet--has-right-overflow
.#{$prefix}--snippet-container
pre::after {
position: absolute;
top: 0;
right: 0;
width: rem(16px);
height: 100%;
// Safari interprets `transparent` differently, so make color token value transparent instead:
background-image: linear-gradient(to right, rgba($layer, 0), $layer);
background-image: linear-gradient(to right, transparent, $layer);
content: '';
}

Expand Down