Skip to content

Commit ed92b42

Browse files
jawinnpfulton
authored andcommitted
docs(fieldgroup): storybook adjustments for invalid
- Include aria-invalid in Storybook markup - Add invalid arg to existing stories because they were showing a combination of options that were against the guidelines (a neutral variant help text with an invalid icon; this should use the negative variant).
1 parent d47d8c5 commit ed92b42

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

components/fieldgroup/stories/fieldgroup.stories.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Import the component markup template
2-
import { Template } from "./template";
32
import { default as Radio } from "@spectrum-css/radio/stories/radio.stories.js";
3+
import { Template } from "./template";
44

55
export default {
66
title: "Components/Field group",
@@ -58,6 +58,7 @@ export default {
5858
export const Vertical = Template.bind({});
5959
Vertical.args = {
6060
layout: "vertical",
61+
isInvalid: true,
6162
items: [
6263
{
6364
id: "1",
@@ -73,6 +74,7 @@ Vertical.args = {
7374
export const Horizontal = Template.bind({});
7475
Horizontal.args = {
7576
layout: "horizontal",
77+
isInvalid: true,
7678
items: [
7779
{
7880
id: "1",

components/fieldgroup/stories/template.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { html } from "lit";
22
import { classMap } from "lit/directives/class-map.js";
3+
import { ifDefined } from "lit/directives/if-defined.js";
34
import { repeat } from "lit/directives/repeat.js";
45

56
import { Template as FieldLabel } from "@spectrum-css/fieldlabel/stories/template.js";
6-
import { Template as Radio } from "@spectrum-css/radio/stories/template.js";
77
import { Template as HelpText } from "@spectrum-css/helptext/stories/template.js";
8+
import { Template as Radio } from "@spectrum-css/radio/stories/template.js";
89

910
import "../index.css";
1011

@@ -35,6 +36,7 @@ export const Template = ({
3536
[`${rootClass}--${layout}`]: typeof layout !== "undefined",
3637
...customClasses.reduce((a, c) => ({ ...a, [c]: true }), {}),
3738
})}
39+
aria-invalid=${ifDefined(isInvalid ? "true" : undefined)}
3840
>
3941
${FieldLabel({
4042
...globals,

0 commit comments

Comments
 (0)