NcRadioGroup: radio buttons don't share a name (no arrow-key navigation)

Open Beginner friendly
#9,278 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript

Research direction

Start with src/components/NcRadioGroupButton/NcRadioGroupButton.vue and useNcRadioGroup.ts to trace how the group context reaches each input. Check the existing radio group tests and add coverage for a shared input name and arrow-key navigation. Done when the options behave as one keyboard-navigable radio group.

Written by the indexing model from the issue text.

Description

bug
Describe the bug

The radio inputs rendered by NcRadioGroupButton inside an NcRadioGroup don't share a name attribute:

https://github.com/nextcloud-libraries/nextcloud-vue/blob/2c19db3f44bb5e909919f3e81e639e01c8085a87/src/components/NcRadioGroupButton/NcRadioGroupButton.vue#L78-L86

Without a common name, browsers don't treat them as one radio group: every option is a separate tab stop and arrow-key navigation between the options doesn't work. There is also no prop to set it, and a name attribute passed by the consumer ends up on the wrapper element, not on the input.

Originally reported in nextcloud/server#58729 (the "Default view" radios in the Files settings); the server can't fix this on its side (see nextcloud/server#58752).

To Reproduce
  1. Open a component using NcRadioGroup with NcRadioGroupButtons (e.g. Files settings → General → Default view).
  2. Tab into the group and press the arrow keys.
  3. The selection doesn't move, and Tab stops at every option.
Expected behavior

All buttons of a group get the same name, e.g. NcRadioGroup generates one with useId() (optionally overridable by a name prop) and provides it through the radio group context (useNcRadioGroup.ts), and NcRadioGroupButton binds it on its <input>. Covered by a test checking the shared name and arrow-key behaviour.

Dominant language
Vue
Stars
246
Forks
104
Avg merge
1d 3h
Merged PRs (30d)
79

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud-libraries/nextcloud-vue

All issues in nextcloud-libraries/nextcloud-vue

Similar issues

More Accessibility issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.