Description
Provide a general summary of the issue here
I have the following JSX inside of a <Radio/>
:
<object
className={cn("aspect-square size-10 rounded object-cover", className)}
width={Number(pass.avatar.width)}
height={Number(pass.avatar.height)}
data={pass.avatar.url}
type={type}
aria-label={pass.name}
ref={forwardedRef}
tabIndex={-1}
>
<img
className={cn("aspect-square size-10 rounded object-cover", className)}
width={Number(pass.avatar.width)}
height={Number(pass.avatar.height)}
src={pass.avatar.thumbnailUrl}
alt={pass.name}
/>
</object>
This markup is used to implement images with a fallback as described here: https://blog.sentry.io/fallbacks-for-http-404-images-in-html-and-javascript/
When navigating with the keyboard across different <Radio/>
's inside of a <RadioGroup/>
, the <object/>
's inside of each <Radio/>
gets focused on rather than the the currently selected <Radio/>
's preceding/proceeding <Radio/>
.
This is because <object/>
's are marked as focusable. I don't believe there is any way to mark <object/>
's as not focusable based on the code in getFocusableTreeWalker()
. If there is a way to explicitly mark JSX elements as not focusable however, that would solve the issue.
Based on what I read from getFocusableTreeWalker()
as well, setting a tabIndex
of -1 to an element only marks the element as not tabbable which thus still causes this bug.
🤔 Expected Behavior?
That keyboard navigation across <Radio/>
's with <object/>
's representing images with fallbacks works.
😯 Current Behavior
Proceeding/preceding <Radio/>
's upon keyboard navigation do not properly get focused.
💁 Possible Solution
No response
🔦 Context
No response
🖥️ Steps to Reproduce
Version
react-aria 3.33.1, 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?
Mac
🧢 Your Company/Team
Only1
🕷 Tracking Issue
No response