adobe / adobe/react-spectrum

alignment is wrong when isHidden is set to true for Text inside ActionButton with icon

Open
#4,946 1 comment 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

For responsive design I would like to remove `` when in mobile view but show it when in larger screens.

### 🤔 Expected Behavior?

Correct alignment.

![image](https://github.com/adobe/react-spectrum/assets/287744/d75a621a-fd17-4b77-a93d-e637d80ee383)

### 😯 Current Behavior

left padding is bigger than the right instead of center aligned.

![image](https://github.com/adobe/react-spectrum/assets/287744/136cb014-6a44-427b-9fab-40e23dd180e3)

### 💁 Possible Solution

`isHidden` should be respected for now I'm using the following workaround.

```typescript
export const useInBaseReponsiveMode = () => {
const { matchedBreakpoints } = useBreakpoint();
const isBase = useMemo(() => {
return getResponsiveProp(
{
base: true,
M: false,
},
matchedBreakpoints
);
}, [matchedBreakpoints]);
return isBase;
};

return (


{!isBase && New}

);
```

Seems like a hack.

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

Set isHidden for ActionButton and resize the window.

```jsx


New

```

### Version

3.29.0

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

Chrome

### If other, please specify.

_No response_

### What operating system are you using?

linux

### 🧢 Your Company/Team

_No response_

### 🕷 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.