Skip to content

Commit

Permalink
Merge branch 'main' into 3640-css-library-assets
Browse files Browse the repository at this point in the history
  • Loading branch information
powellkerry authored Mar 10, 2025
2 parents 94db11c + 9baa5d3 commit da9a61d
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const FormsPatternMultipleTemplate = ({
/>
</va-checkbox-group>
<hr />
<va-button text="click to focus header" onClick={handleClick} uswds={false}></va-button>
<va-button text="Click to focus header" onClick={handleClick}></va-button>
</>
);
};
Expand Down Expand Up @@ -349,7 +349,7 @@ const FormsPatternSingleTemplate = ({

<hr />

<va-button text="click to focus header" onClick={handleClick} uswds={false}></va-button>
<va-button text="Click to focus header" onClick={handleClick}></va-button>
</>
);
};
Expand Down
10 changes: 4 additions & 6 deletions packages/storybook/stories/va-memorable-date-uswds.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ const FormsPatternSingleTemplate = ({ label, name, hint, required, error, value,
<hr />

<va-button
text="click to focus header"
onClick={handleClick}
uswds={false}>
text="Click to focus header"
onClick={handleClick}>
</va-button>
</>
);
Expand Down Expand Up @@ -224,9 +223,8 @@ const FormsPatternMultipleTemplate = ({ label, name, hint, required, error, valu
<hr />

<va-button
text="click to focus header"
onClick={handleClick}
uswds={false}>
text="Click to focus header"
onClick={handleClick}>
</va-button>
</>
);
Expand Down
5 changes: 2 additions & 3 deletions packages/storybook/stories/va-radio-uswds.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,8 @@ const FormsPatternMultipleTemplate = ({ label, required }) => {

<hr />
<va-button
text="click to focus header"
text="Click to focus header"
onClick={handleClick}
uswds={false}
></va-button>
</>
);
Expand Down Expand Up @@ -387,7 +386,7 @@ const FormsPatternSingleTemplate = ({

<hr />

<va-button text="click to focus header" onClick={handleClick} uswds={false}></va-button>
<va-button text="Click to focus header" onClick={handleClick}></va-button>
</>
);
};
Expand Down
2 changes: 1 addition & 1 deletion packages/storybook/stories/va-select-uswds.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const FormsPatternSingleTemplate = args => {
<hr />

<va-button
text="click to focus header"
text="Click to focus header"
onClick={handleClick}
></va-button>
</>
Expand Down
6 changes: 2 additions & 4 deletions packages/storybook/stories/va-text-input-uswds.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,8 @@ const FormsPatternMultipleTemplate = ({ name, value, uswds }) => {
<va-text-input name={name} label="Email address" value={value} />
<hr />
<va-button
text="click to focus header"
text="Click to focus header"
onClick={handleClick}
uswds={false}
></va-button>
</>
);
Expand Down Expand Up @@ -304,9 +303,8 @@ const FormsPatternSingleTemplate = ({ name, value, error }) => {
<hr />

<va-button
text="click to focus header"
text="Click to focus header"
onClick={handleClick}
uswds={false}
></va-button>
</>
);
Expand Down
10 changes: 4 additions & 6 deletions packages/storybook/stories/va-textarea-uswds.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,8 @@ const FormsPatternSingleTemplate = ({
<hr />

<va-button
text="click to focus header"
onClick={handleClick}
uswds={false}>
text="Click to focus header"
onClick={handleClick}>
</va-button>
</>
);
Expand Down Expand Up @@ -230,9 +229,8 @@ const FormsPatternMultipleTemplate = ({
<hr />

<va-button
text="click to focus header"
onClick={handleClick}
uswds={false}>
text="Click to focus header"
onClick={handleClick}>
</va-button>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,16 @@ describe('va-checkbox', () => {
expect(checkboxEl).toEqualAttribute('aria-checked', 'mixed');
});

it('does not set aria-checked when toggled off', async () => {
const page = await newE2EPage();
await page.setContent(
'<va-checkbox label="Just another checkbox here" />',
);
const checkboxEl = await page.find('va-checkbox >>> input');

expect(checkboxEl).not.toHaveAttribute('aria-checked');
});

it('does not set the data-indeterminate attribute if checked is set', async () => {
const page = await newE2EPage();
await page.setContent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ export class VaCheckbox {
.join(' ')
// Return null so we don't add the attribute if we have an empty string
.trim() || null;

let ariaChecked: boolean | string | null;
if (indeterminate && !checked) {
ariaChecked = 'mixed';
} else if (!indeterminate && !checked) {
ariaChecked = null;
} else {
ariaChecked = checked;
}

return (
<Host>
Expand Down Expand Up @@ -266,7 +275,7 @@ export class VaCheckbox {
aria-invalid={error ? 'true' : 'false'}
disabled={disabled}
data-indeterminate={indeterminate && !checked}
aria-checked={indeterminate && !checked ? 'mixed' : checked}
aria-checked={ariaChecked}
/>
<label htmlFor="checkbox-element" class="va-checkbox__label">
<span part="label">{label}</span>&nbsp;
Expand Down

0 comments on commit da9a61d

Please sign in to comment.