Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

Commit e616a43

Browse files
committed
Fix docs for control inputs with initial checked state
Since this is an uncontrolled component, passing the `checked` prop is overriding the `checked` attribute in the DOM. If we use `defaultChecked` it will allow for subsequent updates to be uncontrolled.
1 parent 716364a commit e616a43

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

packages/control-input/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
## Versions
1717

18+
* [v2.1.7 - Replace `checked` attribute with `defaultChecked` on control inputs examples](#v217)
1819
* [v2.1.6 - Update dependencies](#v216)
1920
* [v2.1.5 - Removing web pack dev server, updating dependencies](#v215)
2021
* [v2.1.4 - Fixed build scripts for Windows](#v214)
@@ -38,6 +39,11 @@
3839

3940
## Release History
4041

42+
### v2.1.7
43+
44+
- Replace `checked` attribute with `defaultChecked` on control inputs examples
45+
46+
4147
### v2.1.6
4248

4349
- Update dependencies

packages/control-input/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ The visual test: https://uikit.service.gov.au/packages/control-input/tests/site/
116116

117117
## Release History
118118

119+
* v2.1.7 - Replace `checked` attribute with `defaultChecked` on control inputs examples
119120
* v2.1.6 - Update dependencies
120121
* v2.1.5 - Removing web pack dev server, updating dependencies
121122
* v2.1.4 - Fixed build scripts for Windows

packages/control-input/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@gov.au/control-input",
3-
"version": "2.1.6",
3+
"version": "2.1.7",
44
"description": "Control inputs include radio buttons and checkboxes. They allow users to select one or more options.",
55
"keywords": [
66
"uikit",

packages/control-input/tests/react/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,13 @@ ReactDOM.render(
170170

171171
<hr />
172172
<h2>invalid checkboxes with and without classes</h2>
173-
<AUcheckbox label="I agree" status="invalid" checked />
173+
<AUcheckbox label="I agree" status="invalid" defaultChecked />
174174
<AUcheckbox label="I agree" required />
175175

176176

177177
<hr />
178178
<h2>invalid radio buttons with and without classes</h2>
179-
<AUradio label="I agree" status="invalid" checked />
179+
<AUradio label="I agree" status="invalid" defaultChecked />
180180
<AUradio label="I agree" required />
181181

182182

@@ -281,13 +281,13 @@ ReactDOM.render(
281281

282282
<hr />
283283
<h2>invalid checkboxes with and without classes <code>--dark</code></h2>
284-
<AUcheckbox dark label="I agree" status="invalid" checked />
284+
<AUcheckbox dark label="I agree" status="invalid" defaultChecked />
285285
<AUcheckbox dark label="I agree" required />
286286

287287

288288
<hr />
289289
<h2>invalid radio buttons with and without classes <code>--dark</code></h2>
290-
<AUradio dark label="I agree" status="invalid" checked />
290+
<AUradio dark label="I agree" status="invalid" defaultChecked />
291291
<AUradio dark label="I agree" required />
292292
</div>
293293
</div>
@@ -363,13 +363,13 @@ ReactDOM.render(
363363

364364
<hr />
365365
<h2>invalid checkboxes with and without classes <code>--alt</code></h2>
366-
<AUcheckbox alt label="I agree" status="invalid" checked />
366+
<AUcheckbox alt label="I agree" status="invalid" defaultChecked />
367367
<AUcheckbox alt label="I agree" required />
368368

369369

370370
<hr />
371371
<h2>invalid radio buttons with and without classes <code>--alt</code></h2>
372-
<AUradio alt label="I agree" status="invalid" checked />
372+
<AUradio alt label="I agree" status="invalid" defaultChecked />
373373
<AUradio alt label="I agree" required />
374374
</div>
375375
<div className="split split--alt split--dark">
@@ -441,13 +441,13 @@ ReactDOM.render(
441441

442442
<hr />
443443
<h2>invalid checkboxes with and without classes <code>--alt --dark</code></h2>
444-
<AUcheckbox alt dark label="I agree" status="invalid" checked />
444+
<AUcheckbox alt dark label="I agree" status="invalid" defaultChecked />
445445
<AUcheckbox alt dark label="I agree" required />
446446

447447

448448
<hr />
449449
<h2>invalid radio buttons with and without classes <code>--alt --dark</code></h2>
450-
<AUradio alt dark label="I agree" status="invalid" checked />
450+
<AUradio alt dark label="I agree" status="invalid" defaultChecked />
451451
<AUradio alt dark label="I agree" required />
452452
</div>
453453
</div>

0 commit comments

Comments
 (0)