Radio: isChecked` prop on a DOM element
See original GitHub issueDescription
Rendering a Radio
triggers some react warnings
Link to Reproduction
https://codesandbox.io/s/wispy-worker-frvdq
Steps to reproduce
Simply render a Radio:
<Radio value="Chakra UI">Chakra UI</Radio>
Chakra UI Version
@chakra-ui/react@1.6.10
Browser
Chrome 94.0.4606.81 (Official Build) (arm64)
Operating System
- macOS
- Windows
- Linux
Additional Information
I noticed that those errors are also printed when running the tests in chakra-ui project. Do you think it could be a good solution to fail a test when console.error
is called? That could prevent this kind of errors now and in the future.
Something like:
// .../testSetup.ts
let consoleErrorSpy: jest.SpyInstance;
beforeEach(() => {
consoleErrorSpy = jest.spyOn(console, 'error').mockName('console.error');
});
afterEach(() => {
expect(consoleErrorSpy).not.toHaveBeenCalled();
});
Then if a call to console.error
is expected in a test, you can do:
console.error('testing...');
expect(console.error).toHaveBeenCalled();
(console.error as jest.Mock).mockReset();
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:14 (5 by maintainers)
Top Results From Across the Web
HTML DOM Input Radio checked Property - W3Schools
Definition and Usage. The checked property sets or returns the checked state of a radio button. This property reflects the HTML checked attribute....
Read more >Setting a radio button to be checked as default, only when ...
I want the default behavior to have all the radio buttons unchecked. However, let's say in a form a user selects the 3-star...
Read more >.prop() | jQuery API Documentation
The .prop() method gets the property value for only the first element in the matched set. It returns undefined for the value of...
Read more >How to Use Radio Buttons in ReactJS | Pluralsight
Radio buttons let a user choose a single option from a list of multiple radio buttons and submit its value. For example, here's...
Read more >API - React Select
Defines an element's number or position in the current set of listitems or treeitems. Not required if all elements in the set are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for being annoying but maybe the issue should be closed when there is a related release tag? I had to lock @chakra-ui/react to v1.6.9 for now due to this.
I just pushed a fix for this. It was caused by a recent PR related to the radio component.
We’ll release an update shortly.