Skip to content

Commit

Permalink
fix(code-snippet): remove focus from snippet container (#5202)
Browse files Browse the repository at this point in the history
* fix(code-snippet): remove focus from snippet container

* fix(code-snippet): remove focus on mulit-line snippet

* fix(code-snippet): fix show more styles
  • Loading branch information
tw15egan authored Jan 29, 2020
1 parent 354baa8 commit 625a98b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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

0 comments on commit 625a98b

Please sign in to comment.