adobe / adobe/react-spectrum

`react-aria-components/Tooltip`: `state.placement` should receive full `Placement` instead of `PlacementAxis`

Open
#6,517 5 comments 4 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 feature here

Currently the `state.placement` in `className` or `style` callback is a `PlacementAxis`, which only contains `top` | `bottom` | `left` | `right`.

When the position of the tooltip needs to adjust, it may also need to flip.

e.g. a button at the top-left corner with a tooltip `placement='top end'` should flip on both axis to `bottom start`.

Currently we only get `bottom` which does not provide enough information to adjust the css accordingly.

![image](https://github.com/adobe/react-spectrum/assets/3254987/47f35d05-95df-4257-9310-685fe5b4e998)

### 🤔 Expected Behavior?

`state.placement` contain full `Placement` information.

### 😯 Current Behavior

`state.placement` only contains `PlacementAxis` values.

By the way, do you know in what case `state.placement` will contain the value `center`?

### 💁 Possible Solution

_No response_

### 🔦 Context

The solution is not complete.

### 💻 Examples

_No response_

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