question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radio: isChecked` prop on a DOM element

See original GitHub issue

Description

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:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

9reactions
futhrcommented, Oct 26, 2021

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.

6reactions
segunadebayocommented, Oct 25, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found