Skip to content

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

@wonu

Description

@wonu

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 [email protected].

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.linear: nextConfirmed issue that is tracked by the Next.js team.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions