prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Wagtail 6.1.x update breaks `RadioSelect` initialiastion after replacing jQuery with vanilla JS
  ### Issue Summary
  
  Wagtail 6.1.x update breaks `RadioSelect` initialiastion after replacing jQuery with vanilla JS.  
  
  The JS adapter [`BoundRadioSelect`](https://github.com/wagtail/wagtail/blob/main/client/src/entrypoints/admin/telepath/widgets.js#L150) previously tested and set the checked option by comparing the element value against an array value - an array value is passed to the constructor:
  
  #### Wagtail 6.0 implementation
  ```
  setState(state) {
      this.element.find('input[name="' + this.name + '"]').val([state]);
  }
  ```
  
  It now tests against a string, and the equality operator fails, so the radio option is not correctly set as `checked` on initialisation:
  
  #### Wagtail 6.1.x implementation
  ```
    setState(state) {
      const inputs = this.element.querySelectorAll(`input[name="${this.name}"]`);
      for (let i = 0; i < inputs.length; i += 1) {
        inputs[i].checked = inputs[i].value === state;
      }
    }
    ```
  
  The breaking change is here:
  
  https://github.com/wagtail/wagtail/compare/v6.0.3...v6.1#diff-70fd977dfb7c5b823eab70485fa842987589fc8656203ffb729a4b7d688c1d04L130
  
  ### Steps to Reproduce
  
  1. Use a choice block within a Streamfield such as:
  
  ```
  link_type = blocks.ChoiceBlock(
      choices=[
          ('page', 'Page'),
          ('document', 'Document'),
          ('url', 'URL'),
      ],
      widget=forms.RadioSelect,
      required=True,
      default='page',
  )
  ```
  2. View/edit a page/snippet where this field is used
  3. In Wagtail 6.0.x the first choice is `checked` as expected
  4. In Wagtail 6.1.x the first choice is not `checked` as expected
  
  -   I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes
  
  ### Technical details
  
  -   Python version: Python 3.12.3
  -   Django version: 5.0.6
  -   Wagtail version: 6.1.x
  -   Browser version: Chrome 125
  
  ### Working on this
  
  Anyone can contribute to this. View our [contributing guidelines](https://docs.wagtail.org/en/latest/contributing/index.html), add a comment to the issue once you’re ready to start.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `wagtail/widget_adapters.py`
  Content:
  ```
  1 """
  2 Register Telepath adapters for core Django form widgets, so that they can
  3 have corresponding Javascript objects with the ability to render new instances
  4 and extract field values.
  5 """
  6 
  7 from django import forms
  8 from django.core.exceptions import ValidationError
  9 from django.utils.functional import cached_property
  10 
  11 from wagtail.admin.staticfiles import versioned_static
  12 from wagtail.telepath import Adapter, register
  13 
  14 
  15 class WidgetAdapter(Adapter):
  16     js_constructor = "wagtail.widgets.Widget"
  17 
  18     def js_args(self, widget):
  19         return [
  20             widget.render("__NAME__", None, attrs={"id": "__ID__"}),
  21             widget.id_for_label("__ID__"),
  22         ]
  23 
  24     def get_media(self, widget):
  25         media = super().get_media(widget)
  26         return media + widget.media
  27 
  28     @cached_property
  29     def media(self):
  30         return forms.Media(
  31             js=[
  32                 versioned_static("wagtailadmin/js/telepath/widgets.js"),
  33             ]
  34         )
  35 
  36 
  37 register(WidgetAdapter(), forms.widgets.Input)
  38 register(WidgetAdapter(), forms.Textarea)
  39 register(WidgetAdapter(), forms.CheckboxSelectMultiple)
  40 
  41 
  42 class CheckboxInputAdapter(WidgetAdapter):
  43     js_constructor = "wagtail.widgets.CheckboxInput"
  44 
  45 
  46 register(CheckboxInputAdapter(), forms.CheckboxInput)
  47 
  48 
  49 class RadioSelectAdapter(WidgetAdapter):
  50     js_constructor = "wagtail.widgets.RadioSelect"
  51 
  52 
  53 register(RadioSelectAdapter(), forms.RadioSelect)
  54 
  55 
  56 class SelectAdapter(WidgetAdapter):
  57     js_constructor = "wagtail.widgets.Select"
  58 
  59 
  60 register(SelectAdapter(), forms.Select)
  61 
  62 
  63 class ValidationErrorAdapter(Adapter):
  64     js_constructor = "wagtail.errors.ValidationError"
  65 
  66     def js_args(self, error):
  67         return [
  68             error.messages,
  69         ]
  70 
  71     @cached_property
  72     def media(self):
  73         return forms.Media(
  74             js=[
  75                 versioned_static("wagtailadmin/js/telepath/widgets.js"),
  76             ]
  77         )
  78 
  79 
  80 register(ValidationErrorAdapter(), ValidationError)
  81
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/wagtail/widget_adapters.py b/wagtail/widget_adapters.py
  --- a/wagtail/widget_adapters.py
  +++ b/wagtail/widget_adapters.py
  @@ -36,7 +36,6 @@
   
   register(WidgetAdapter(), forms.widgets.Input)
   register(WidgetAdapter(), forms.Textarea)
  -register(WidgetAdapter(), forms.CheckboxSelectMultiple)
   
   
   class CheckboxInputAdapter(WidgetAdapter):
  @@ -51,6 +50,7 @@
   
   
   register(RadioSelectAdapter(), forms.RadioSelect)
  +register(RadioSelectAdapter(), forms.CheckboxSelectMultiple)
   
   
   class SelectAdapter(WidgetAdapter):
  
verification_info: {"golden_diff": "diff --git a/wagtail/widget_adapters.py b/wagtail/widget_adapters.py\n--- a/wagtail/widget_adapters.py\n+++ b/wagtail/widget_adapters.py\n@@ -36,7 +36,6 @@\n \n register(WidgetAdapter(), forms.widgets.Input)\n register(WidgetAdapter(), forms.Textarea)\n-register(WidgetAdapter(), forms.CheckboxSelectMultiple)\n \n \n class CheckboxInputAdapter(WidgetAdapter):\n@@ -51,6 +50,7 @@\n \n \n register(RadioSelectAdapter(), forms.RadioSelect)\n+register(RadioSelectAdapter(), forms.CheckboxSelectMultiple)\n \n \n class SelectAdapter(WidgetAdapter):\n", "issue": "Wagtail 6.1.x update breaks `RadioSelect` initialiastion after replacing jQuery with vanilla JS\n### Issue Summary\r\n\r\nWagtail 6.1.x update breaks `RadioSelect` initialiastion after replacing jQuery with vanilla JS.  \r\n\r\nThe JS adapter [`BoundRadioSelect`](https://github.com/wagtail/wagtail/blob/main/client/src/entrypoints/admin/telepath/widgets.js#L150) previously tested and set the checked option by comparing the element value against an array value - an array value is passed to the constructor:\r\n\r\n#### Wagtail 6.0 implementation\r\n```\r\nsetState(state) {\r\n    this.element.find('input[name=\"' + this.name + '\"]').val([state]);\r\n}\r\n```\r\n\r\nIt now tests against a string, and the equality operator fails, so the radio option is not correctly set as `checked` on initialisation:\r\n\r\n#### Wagtail 6.1.x implementation\r\n```\r\n  setState(state) {\r\n    const inputs = this.element.querySelectorAll(`input[name=\"${this.name}\"]`);\r\n    for (let i = 0; i < inputs.length; i += 1) {\r\n      inputs[i].checked = inputs[i].value === state;\r\n    }\r\n  }\r\n  ```\r\n\r\nThe breaking change is here:\r\n\r\nhttps://github.com/wagtail/wagtail/compare/v6.0.3...v6.1#diff-70fd977dfb7c5b823eab70485fa842987589fc8656203ffb729a4b7d688c1d04L130\r\n\r\n### Steps to Reproduce\r\n\r\n1. Use a choice block within a Streamfield such as:\r\n\r\n```\r\nlink_type = blocks.ChoiceBlock(\r\n    choices=[\r\n        ('page', 'Page'),\r\n        ('document', 'Document'),\r\n        ('url', 'URL'),\r\n    ],\r\n    widget=forms.RadioSelect,\r\n    required=True,\r\n    default='page',\r\n)\r\n```\r\n2. View/edit a page/snippet where this field is used\r\n3. In Wagtail 6.0.x the first choice is `checked` as expected\r\n4. In Wagtail 6.1.x the first choice is not `checked` as expected\r\n\r\n-   I have confirmed that this issue can be reproduced as described on a fresh Wagtail project: yes\r\n\r\n### Technical details\r\n\r\n-   Python version: Python 3.12.3\r\n-   Django version: 5.0.6\r\n-   Wagtail version: 6.1.x\r\n-   Browser version: Chrome 125\r\n\r\n### Working on this\r\n\r\nAnyone can contribute to this. View our [contributing guidelines](https://docs.wagtail.org/en/latest/contributing/index.html), add a comment to the issue once you\u2019re ready to start.\r\n\n", "before_files": [{"content": "\"\"\"\nRegister Telepath adapters for core Django form widgets, so that they can\nhave corresponding Javascript objects with the ability to render new instances\nand extract field values.\n\"\"\"\n\nfrom django import forms\nfrom django.core.exceptions import ValidationError\nfrom django.utils.functional import cached_property\n\nfrom wagtail.admin.staticfiles import versioned_static\nfrom wagtail.telepath import Adapter, register\n\n\nclass WidgetAdapter(Adapter):\n    js_constructor = \"wagtail.widgets.Widget\"\n\n    def js_args(self, widget):\n        return [\n            widget.render(\"__NAME__\", None, attrs={\"id\": \"__ID__\"}),\n            widget.id_for_label(\"__ID__\"),\n        ]\n\n    def get_media(self, widget):\n        media = super().get_media(widget)\n        return media + widget.media\n\n    @cached_property\n    def media(self):\n        return forms.Media(\n            js=[\n                versioned_static(\"wagtailadmin/js/telepath/widgets.js\"),\n            ]\n        )\n\n\nregister(WidgetAdapter(), forms.widgets.Input)\nregister(WidgetAdapter(), forms.Textarea)\nregister(WidgetAdapter(), forms.CheckboxSelectMultiple)\n\n\nclass CheckboxInputAdapter(WidgetAdapter):\n    js_constructor = \"wagtail.widgets.CheckboxInput\"\n\n\nregister(CheckboxInputAdapter(), forms.CheckboxInput)\n\n\nclass RadioSelectAdapter(WidgetAdapter):\n    js_constructor = \"wagtail.widgets.RadioSelect\"\n\n\nregister(RadioSelectAdapter(), forms.RadioSelect)\n\n\nclass SelectAdapter(WidgetAdapter):\n    js_constructor = \"wagtail.widgets.Select\"\n\n\nregister(SelectAdapter(), forms.Select)\n\n\nclass ValidationErrorAdapter(Adapter):\n    js_constructor = \"wagtail.errors.ValidationError\"\n\n    def js_args(self, error):\n        return [\n            error.messages,\n        ]\n\n    @cached_property\n    def media(self):\n        return forms.Media(\n            js=[\n                versioned_static(\"wagtailadmin/js/telepath/widgets.js\"),\n            ]\n        )\n\n\nregister(ValidationErrorAdapter(), ValidationError)\n", "path": "wagtail/widget_adapters.py"}], "after_files": [{"content": "\"\"\"\nRegister Telepath adapters for core Django form widgets, so that they can\nhave corresponding Javascript objects with the ability to render new instances\nand extract field values.\n\"\"\"\n\nfrom django import forms\nfrom django.core.exceptions import ValidationError\nfrom django.utils.functional import cached_property\n\nfrom wagtail.admin.staticfiles import versioned_static\nfrom wagtail.telepath import Adapter, register\n\n\nclass WidgetAdapter(Adapter):\n    js_constructor = \"wagtail.widgets.Widget\"\n\n    def js_args(self, widget):\n        return [\n            widget.render(\"__NAME__\", None, attrs={\"id\": \"__ID__\"}),\n            widget.id_for_label(\"__ID__\"),\n        ]\n\n    def get_media(self, widget):\n        media = super().get_media(widget)\n        return media + widget.media\n\n    @cached_property\n    def media(self):\n        return forms.Media(\n            js=[\n                versioned_static(\"wagtailadmin/js/telepath/widgets.js\"),\n            ]\n        )\n\n\nregister(WidgetAdapter(), forms.widgets.Input)\nregister(WidgetAdapter(), forms.Textarea)\n\n\nclass CheckboxInputAdapter(WidgetAdapter):\n    js_constructor = \"wagtail.widgets.CheckboxInput\"\n\n\nregister(CheckboxInputAdapter(), forms.CheckboxInput)\n\n\nclass RadioSelectAdapter(WidgetAdapter):\n    js_constructor = \"wagtail.widgets.RadioSelect\"\n\n\nregister(RadioSelectAdapter(), forms.RadioSelect)\nregister(RadioSelectAdapter(), forms.CheckboxSelectMultiple)\n\n\nclass SelectAdapter(WidgetAdapter):\n    js_constructor = \"wagtail.widgets.Select\"\n\n\nregister(SelectAdapter(), forms.Select)\n\n\nclass ValidationErrorAdapter(Adapter):\n    js_constructor = \"wagtail.errors.ValidationError\"\n\n    def js_args(self, error):\n        return [\n            error.messages,\n        ]\n\n    @cached_property\n    def media(self):\n        return forms.Media(\n            js=[\n                versioned_static(\"wagtailadmin/js/telepath/widgets.js\"),\n            ]\n        )\n\n\nregister(ValidationErrorAdapter(), ValidationError)\n", "path": "wagtail/widget_adapters.py"}]}