Skip to content

Commit da9a61d

Browse files
authored
Merge branch 'main' into 3640-css-library-assets
2 parents 94db11c + 9baa5d3 commit da9a61d

File tree

8 files changed

+35
-23
lines changed

8 files changed

+35
-23
lines changed

packages/storybook/stories/va-checkbox-group-uswds.stories.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ const FormsPatternMultipleTemplate = ({
285285
/>
286286
</va-checkbox-group>
287287
<hr />
288-
<va-button text="click to focus header" onClick={handleClick} uswds={false}></va-button>
288+
<va-button text="Click to focus header" onClick={handleClick}></va-button>
289289
</>
290290
);
291291
};
@@ -349,7 +349,7 @@ const FormsPatternSingleTemplate = ({
349349

350350
<hr />
351351

352-
<va-button text="click to focus header" onClick={handleClick} uswds={false}></va-button>
352+
<va-button text="Click to focus header" onClick={handleClick}></va-button>
353353
</>
354354
);
355355
};

packages/storybook/stories/va-memorable-date-uswds.stories.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,8 @@ const FormsPatternSingleTemplate = ({ label, name, hint, required, error, value,
173173
<hr />
174174

175175
<va-button
176-
text="click to focus header"
177-
onClick={handleClick}
178-
uswds={false}>
176+
text="Click to focus header"
177+
onClick={handleClick}>
179178
</va-button>
180179
</>
181180
);
@@ -224,9 +223,8 @@ const FormsPatternMultipleTemplate = ({ label, name, hint, required, error, valu
224223
<hr />
225224

226225
<va-button
227-
text="click to focus header"
228-
onClick={handleClick}
229-
uswds={false}>
226+
text="Click to focus header"
227+
onClick={handleClick}>
230228
</va-button>
231229
</>
232230
);

packages/storybook/stories/va-radio-uswds.stories.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,8 @@ const FormsPatternMultipleTemplate = ({ label, required }) => {
331331

332332
<hr />
333333
<va-button
334-
text="click to focus header"
334+
text="Click to focus header"
335335
onClick={handleClick}
336-
uswds={false}
337336
></va-button>
338337
</>
339338
);
@@ -387,7 +386,7 @@ const FormsPatternSingleTemplate = ({
387386

388387
<hr />
389388

390-
<va-button text="click to focus header" onClick={handleClick} uswds={false}></va-button>
389+
<va-button text="Click to focus header" onClick={handleClick}></va-button>
391390
</>
392391
);
393392
};

packages/storybook/stories/va-select-uswds.stories.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ const FormsPatternSingleTemplate = args => {
286286
<hr />
287287

288288
<va-button
289-
text="click to focus header"
289+
text="Click to focus header"
290290
onClick={handleClick}
291291
></va-button>
292292
</>

packages/storybook/stories/va-text-input-uswds.stories.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,8 @@ const FormsPatternMultipleTemplate = ({ name, value, uswds }) => {
259259
<va-text-input name={name} label="Email address" value={value} />
260260
<hr />
261261
<va-button
262-
text="click to focus header"
262+
text="Click to focus header"
263263
onClick={handleClick}
264-
uswds={false}
265264
></va-button>
266265
</>
267266
);
@@ -304,9 +303,8 @@ const FormsPatternSingleTemplate = ({ name, value, error }) => {
304303
<hr />
305304

306305
<va-button
307-
text="click to focus header"
306+
text="Click to focus header"
308307
onClick={handleClick}
309-
uswds={false}
310308
></va-button>
311309
</>
312310
);

packages/storybook/stories/va-textarea-uswds.stories.jsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,8 @@ const FormsPatternSingleTemplate = ({
153153
<hr />
154154

155155
<va-button
156-
text="click to focus header"
157-
onClick={handleClick}
158-
uswds={false}>
156+
text="Click to focus header"
157+
onClick={handleClick}>
159158
</va-button>
160159
</>
161160
);
@@ -230,9 +229,8 @@ const FormsPatternMultipleTemplate = ({
230229
<hr />
231230

232231
<va-button
233-
text="click to focus header"
234-
onClick={handleClick}
235-
uswds={false}>
232+
text="Click to focus header"
233+
onClick={handleClick}>
236234
</va-button>
237235
</>
238236
);

packages/web-components/src/components/va-checkbox/test/va-checkbox.e2e.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,16 @@ describe('va-checkbox', () => {
284284
expect(checkboxEl).toEqualAttribute('aria-checked', 'mixed');
285285
});
286286

287+
it('does not set aria-checked when toggled off', async () => {
288+
const page = await newE2EPage();
289+
await page.setContent(
290+
'<va-checkbox label="Just another checkbox here" />',
291+
);
292+
const checkboxEl = await page.find('va-checkbox >>> input');
293+
294+
expect(checkboxEl).not.toHaveAttribute('aria-checked');
295+
});
296+
287297
it('does not set the data-indeterminate attribute if checked is set', async () => {
288298
const page = await newE2EPage();
289299
await page.setContent(

packages/web-components/src/components/va-checkbox/va-checkbox.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,15 @@ export class VaCheckbox {
232232
.join(' ')
233233
// Return null so we don't add the attribute if we have an empty string
234234
.trim() || null;
235+
236+
let ariaChecked: boolean | string | null;
237+
if (indeterminate && !checked) {
238+
ariaChecked = 'mixed';
239+
} else if (!indeterminate && !checked) {
240+
ariaChecked = null;
241+
} else {
242+
ariaChecked = checked;
243+
}
235244

236245
return (
237246
<Host>
@@ -266,7 +275,7 @@ export class VaCheckbox {
266275
aria-invalid={error ? 'true' : 'false'}
267276
disabled={disabled}
268277
data-indeterminate={indeterminate && !checked}
269-
aria-checked={indeterminate && !checked ? 'mixed' : checked}
278+
aria-checked={ariaChecked}
270279
/>
271280
<label htmlFor="checkbox-element" class="va-checkbox__label">
272281
<span part="label">{label}</span>&nbsp;

0 commit comments

Comments
 (0)