adobe / adobe/react-spectrum

Radio#onPress should not be triggered with RadioGroup#isReadOnly

Open
#9,425 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

```ts
import React from "react";
import { Radio, RadioGroup } from "react-aria-components";
import { useState } from "react";
import "./styles.css";

export default function App() {
const [pressed, setPressed] = useState("not pressed");
return (

console.log("pressed")}>
{pressed}


);
}
```

The `onPress` should not be called when `RadioGroup` has `isReadOnly`.

It was working correctly in 1.0.0 but not in 1.13.0 or 1.14.0

### 🤔 Expected Behavior?

The event handler should not be triggered.

### 😯 Current Behavior

triggered

### 💁 Possible Solution

_No response_

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

https://codesandbox.io/p/devbox/cold-paper-sf7qvr?workspaceId=ws_PdRAjWPWBahRgFmAnbSnLv

### Version

1.14.0

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

macos/windows

### 🧢 Your Company/Team

Palo Alto Networks

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.