Skip to content

Commit

Permalink
fix(slider): keyboard focus works in storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
mdt2 authored and pfulton committed Nov 9, 2023
1 parent 2214996 commit b0736dc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/slider/stories/template.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { html } from "lit";
import { classMap } from "lit/directives/class-map.js";
import { styleMap } from "lit/directives/style-map.js";
import { ifDefined } from "lit/directives/if-defined.js";
import { styleMap } from "lit/directives/style-map.js";

import { useArgs, useGlobals } from "@storybook/client-api";

Expand Down Expand Up @@ -142,6 +142,14 @@ export const Template = ({
})}
role=${ifDefined(values.length > 1 ? "group" : undefined)}
aria-labelledby=${ifDefined(label && id ? `${id}-label` : undefined)}
@focusin=${() => {
const focusClass = { isFocused: true };
updateArgs(focusClass);
}}
@focusout=${() => {
const focusClass = { isFocused: false };
updateArgs(focusClass);
}}
>
<!-- Label region -->
${label
Expand Down

0 comments on commit b0736dc

Please sign in to comment.