adobe / adobe/react-spectrum

`useOverlayTrigger` is missing `aria-haspopup` on most `triggerProps`

Open
#9,542 3 comments 0 reactions 0 assignees View on GitHub
needs investigation
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

When using `{ type: 'dialog' }` or `grid` or `tree`, the resulting `triggerProps` does not contain `aria-haspopup="ROLE_HERE"`.

The `aria-haspopup` attribute only seems to be set when using `menu` or `listbox`.

### 🤔 Expected Behavior?

The `aria-haspopup` attribute on `triggerProps` should match the provided `type`.

### 😯 Current Behavior

The `aria-haspopup` attribute is missing for most types.

### 💁 Possible Solution

Add the `aria-haspopup` attribute for the remaining types.

### 🔦 Context

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-haspopup#dialog

### 🖥️ Steps to Reproduce

Relevant code snippet:
https://github.com/adobe/react-spectrum/blob/858d6cdd45bcf52ee33706a07f360bf68866a30b/packages/%40react-aria/overlays/src/useOverlayTrigger.ts#L53

>We only set it as menu because screen readers announce it as menu anyway.

This doesn't feel forward-supportive for screen readers that do add support for these other values. 🤔 Is there harm to setting it to `dialog` and having the screen reader announce `menu` anyway? At least it would add support for screen readers that _do_ support `dialog`.

### Version

N/A

### 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_

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.