adobe / adobe/react-spectrum

[RAC] Use of `useLabels()` is inconsistent across components

Open
#7,240 3 comments 1 reaction 0 assignees View on GitHub
bug
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

I was wondering why `useLabels()` is not used consistently throughout the project even though most components inherit the `AriaLabelingProps` and therefore have both `aria-label` & `aria-labelledby` available. I don't think it causes issues in most cases but i am sure it has some edge cases that warranted the existence of `useLabels()` in the first place.

Examples of missing `useLabels()`:

- Button
- Breadcrumbs
- ...
- Pretty much all components not utilizing `useLabel()` in some way.

### 🤔 Expected Behavior?

`useLabels()` should be applicable to all components inheriting `AriaLabelingProps`.

### 😯 Current Behavior

Only field components and some other components make use of it.

### 💁 Possible Solution

Ensure that `useLabels()` is used to merge labels in all components.

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

https://codesandbox.io/p/sandbox/jolly-https-rzwrzp

### Version

latest

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