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): remove focus from snippet container #5202

Merged
merged 5 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@

// Show more / less button
button.#{$prefix}--btn.#{$prefix}--snippet-btn--expand {
@include type-style('body-short-01');
@include carbon--font-family('sans');
border: 0;
display: inline-flex;
align-items: center;
position: absolute;
Expand Down Expand Up @@ -299,6 +302,7 @@

.#{$prefix}--snippet-btn--expand:focus {
@include focus-outline('outline');
border-color: transparent;
}

.#{$prefix}--snippet--expand
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

<div class="{{@root.prefix}}--snippet {{@root.prefix}}--snippet--{{variant}}" {{#is variant "multi"}}
data-code-snippet{{/is}}>
<div class="{{@root.prefix}}--snippet-container" aria-label="Code Snippet Text">
<div {{#is variant "single"}}tabindex="0" {{/is}} class="{{@root.prefix}}--snippet-container"
aria-label="Code Snippet Text">
<pre>
<code>@mixin grid-container {
width: 100%;
Expand Down
4 changes: 2 additions & 2 deletions packages/react/src/components/CodeSnippet/CodeSnippet.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ function CodeSnippet({
return (
<div {...rest} className={codeSnippetClasses}>
<div
role="textbox"
tabIndex={0}
role={type === 'single' ? 'textbox' : null}
tabIndex={type === 'single' ? 0 : null}
className={`${prefix}--snippet-container`}
aria-label={ariaLabel || copyLabel || 'code-snippet'}>
<code>
Expand Down