Skip to content

Commit 7932f55

Browse files
authored
fix(a11y): correctly narrate tab status in storybook editor (#3220)
* fix stackblitz selected bug * apply review suggestions
1 parent d6b7942 commit 7932f55

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.storybook/addons/codeEditorAddon/editor.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ export class EditorElement extends LitElement {
205205
}
206206
}
207207

208+
generateStackblitzProject = () => {
209+
this.currentType = 'stackblitz';
210+
generateProject(this.title, this.files);
211+
};
212+
208213
tabKeyDown = e => {
209214
const tabs = this.renderRoot.querySelectorAll('.tab');
210215
// Move right
@@ -251,10 +256,12 @@ export class EditorElement extends LitElement {
251256
)}
252257
253258
<button
254-
@click="${_ => generateProject(this.title, this.files)}"
259+
@click="${this.generateStackblitzProject}"
260+
tabindex="${this.currentType === 'stackblitz' ? 0 : -1}"
255261
id="project"
256262
role="tab"
257263
class="tab tab-right"
264+
aria-selected="${this.currentType === 'stackblitz'}"
258265
title="Edit in StackBlitz"
259266
>
260267
<svg viewBox="0 0 14 14" width="14px" height="14px" class="css-149xqrd"><path d="M2 1a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V7.5a.5.5 0 0 0-1 0V12H2V2h4.5a.5.5 0 0 0 0-1H2Z"></path><path d="M7.35 7.36 12 2.7v1.8a.5.5 0 0 0 1 0v-3a.5.5 0 0 0-.5-.5h-3a.5.5 0 1 0 0 1h1.8L6.64 6.64a.5.5 0 1 0 .7.7Z"></path></svg>

0 commit comments

Comments
 (0)