Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEXT-1197] (AppDir) <input type="radio" defaultChecked /> is unchecked immediately. #48778

Closed
1 task done
wonu opened this issue Apr 24, 2023 · 7 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked

Comments

@wonu
Copy link

wonu commented Apr 24, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: Ubuntu 20.04.0 LTS Mon Apr 24 2023 23:03:08 GMT+0900
    Binaries:
      Node: 16.14.2
      npm: 7.17.0
      Yarn: 1.22.19
      pnpm: 8.2.0
    Relevant packages:
      next: 13.3.2-canary.2
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true)

Link to the code that reproduces this issue

https://stackblitz.com/edit/vercel-next-js-cnys4q (app directory, the issue happens)

https://stackblitz.com/edit/vercel-next-js-m8f8gg (pages directory, the issue doesn't happen)

To Reproduce

bandicam.2023-04-24.22-56-18-749.mp4

Describe the Bug

There are 4 <input type="radio">s

  • <input type="radio" name="a" defaultChecked={true} />
  • <input type="radio" name="a" defaultChecked={false} />
  • <input type="radio" name="b" defaultChecked={true} />
  • <input type="radio" defaultChecked={true} />

On page refresh, the first, third and fourth one have been checked initially, but the first one is unchecked right after.
This issue seems that was introduced since next@13.3.1-canary.17.

Expected Behavior

Default checked radio input that has same name should remains checked.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

NEXT-1197

@wonu wonu added the bug Issue was opened via the bug report template. label Apr 24, 2023
@wonu wonu changed the title <input type="radio" defaultChecked /> is unchecked immediately. (AppDir) <input type="radio" defaultChecked /> is unchecked immediately. Apr 26, 2023
@jakelazaroff
Copy link

jakelazaroff commented May 8, 2023

Just ran into this so wanted to update — still experiencing this in 13.4.1 (stable) and it happens with checked as well.

To anyone running across this issue, here's how I solved it pending an actual fix:

<input
  type="radio"
  name="a"
  defaultChecked={shouldBeChecked}
  ref={input => {
    if (input && shouldBeChecked) input.checked = true;
  }}
/>

@timneutkens timneutkens added the linear: next Confirmed issue that is tracked by the Next.js team. label May 17, 2023
@timneutkens timneutkens changed the title (AppDir) <input type="radio" defaultChecked /> is unchecked immediately. [NEXT-1197] (AppDir) <input type="radio" defaultChecked /> is unchecked immediately. May 17, 2023
@anmoti

This comment has been minimized.

@sophiebits
Copy link
Contributor

Should be fixed in v13.5.6-canary.1 via 0a80017

@cphoover
Copy link

cphoover commented Oct 18, 2023

Why do I always run into the weirdest bugs.

Also seeing this behavior

@tialki
Copy link

tialki commented Nov 6, 2023

Still exists in version 13.5.6 under dev mode.

@timneutkens
Copy link
Member

Going to close this as no new reproduction was provided. If you're running into something like this please open a new issue with a reproduction. Thanks!

Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. linear: next Confirmed issue that is tracked by the Next.js team. locked
Projects
None yet
Development

No branches or pull requests

7 participants