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

The Radio from react-aria-components is missing excludeFromTabOrder prop #6569

Open
KelvinOm opened this issue Jun 19, 2024 · 7 comments
Open
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@KelvinOm
Copy link

Provide a general summary of the issue here

The Radio from react-aria-components is missing excludeFromTabOrder prop

🤔 Expected Behavior?

There is possibility to exclude the Radio component from the sequential tab order

😯 Current Behavior

There is no way to exclude the Radio component from the sequential tab order

💁 Possible Solution

No response

🔦 Context

No response

🖥️ Steps to Reproduce

Simply try to exclude the Radio from tab order.

Version

react-aria-components: 1.2.1

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

@snowystinger
Copy link
Member

Can you share an example for why you need to exclude a radio from the tab order?

@akyllus
Copy link

akyllus commented Jun 19, 2024

To address the issue of the missing excludeFromTabOrder prop in the Radio component from react-aria-components, we need to modify the component to accept this prop and then use it to control the tab order behavior. Below is an example of how this could be implemented:

  1. Update the Radio Component:
jsx
  | import React, { useRef } from 'react'; -- | --   | import { useFocusable } from '@react-aria/focus';   |     | function Radio({ children, isDisabled, excludeFromTabOrder, ...props }) {   | const ref = useRef(null);   | const { focusableProps } = useFocusable(   | {   | ...props,   | isDisabled,   | excludeFromTabOrder,   | },   | ref   | );   |     | return (   |   |   | {children}   |   | );   | }   |     | export default Radio;

@KelvinOm
Copy link
Author

Can you share an example for why you need to exclude a radio from the tab order?

In our app, we use components only for presentation in some mode, without the ability to interact with them. Regardless, I believe that the behavior of these components should be consistent throughout the library(other components have excludeFromTabOrder prop).

@snowystinger
Copy link
Member

I don't think it makes sense for Radio to be excluded from tab order.
Radios only exist in a RadioGroup and RadioGroup is itself a single tab stop, arrow keys to move around inside it.

You could use the RadioGroup as readonly. Then the information is still available to all users, not just the sighted users.

If it's purely visual and is just decoration, then you don't need to use a RadioGroup or Radio at all, just style some divs to look like one.

I'll double check if that prop should be exposed on so many things. It seems further reaching than I had remembered. Adding it to RadioGroup would be the thing to do if we're making it match the others though.

@KelvinOm
Copy link
Author

@snowystinger Yes, you are absolutely right. It is best to add this prop to the RadioGroup.

@KelvinOm
Copy link
Author

@snowystinger I also noticed that it is also not possible to specify the prop for the Link component. I also can't pass the tabIndex prop, which is a valid parameter for the link.

@snowystinger
Copy link
Member

Chatted with the team, adding to RadioGroup is the right move.
Given Button has it, Link should be fine as well.
Thanks for bringing it up.

Want to open a PR with the change?

@snowystinger snowystinger added bug Something isn't working good first issue Good for newcomers labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants