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

Audit avt1 component demo label text area #2335

21 changes: 15 additions & 6 deletions src/components/ComponentDemo/ComponentDemo.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable jsx-a11y/label-has-associated-control */
/* eslint-disable import/no-extraneous-dependencies */
import React, { useState, useContext } from 'react';
import getTheme from 'gatsby-theme-carbon/src/components/Code/getTheme';
Expand Down Expand Up @@ -59,6 +60,8 @@ const ComponentDemo = ({ children, src, scope, noInline, components }) => {
const [knobs, setKnobs] = useState(initialVariant.props.knobs);
const [links, setLinks] = useState(initialVariant.props.links);

console.log('something', components[0]);
jnm2377 marked this conversation as resolved.
Show resolved Hide resolved

const themes = {
White: white,
'Gray 10': g10,
Expand Down Expand Up @@ -162,12 +165,18 @@ const ComponentDemo = ({ children, src, scope, noInline, components }) => {
)}

<Code links={links} code={code} src={src} className={codeRow}>
<LiveEditor
padding={16}
style={{ overflowX: 'auto', whiteSpace: 'pre' }}
onChange={(updatedCode) => setCode(updatedCode)}
className={editorContainer}
/>
<label htmlFor="live-editor-label">
<span className="live-editor-label">
`Live editor for the ${components[0].label} component`
</span>
<LiveEditor
padding={16}
style={{ overflowX: 'auto', whiteSpace: 'pre' }}
onChange={(updatedCode) => setCode(updatedCode)}
className={editorContainer}
textareaId="live-editor-label"
/>
</label>
jnm2377 marked this conversation as resolved.
Show resolved Hide resolved
</Code>
{knobs && (
<>
Expand Down
13 changes: 13 additions & 0 deletions src/components/ComponentDemo/ComponentDemo.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -477,3 +477,16 @@ body {
}
}
}

:global(.live-editor-label) {
position: absolute;
overflow: hidden;
width: 1px;
height: 1px;
padding: 0;
border: 0;
margin: -1px;
clip: rect(0, 0, 0, 0);
visibility: inherit;
white-space: nowrap;
}
2 changes: 1 addition & 1 deletion src/pages/components/accordion/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']

<PageDescription>

An accordion is a vertically stacked list of headers that reveal or hide
THE accordion is a vertically stacked list of headers that reveal or hide
jnm2377 marked this conversation as resolved.
Show resolved Hide resolved
associated sections of content.

</PageDescription>
Expand Down