adobe / adobe/react-spectrum

Expose FocusableProvider in `react-aria`

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

Description

# 🙋 Feature Request

Expose `FocusableProvider` from `react-aria`

## 🤔 Expected Behavior

Have the ability to inject custom dom attributes into focusable elements

## 😯 Current Behavior

public `useFocusable` uses context to inject dom attributes, but the provider is not exposed to the public

## 💁 Possible Solution

Export `FocusableProvider` the same way `useFocusable` is

## 🔦 Context

I'm working on a Tooltip component and I noticed spectrum uses FocusableProvider to implement a nice API where props are automatically injected. I want to do the same. Right now I'm using `@react-aria/focus` to do that, but I think that should be part of `react-aria` package itself

## 💻 Examples

[Example usage in react-spectrum](https://github.com/adobe/react-spectrum/blob/1ddcde7b4fef9af7f08e11bb78d71fe60bbcc64b/packages/%40react-spectrum/tooltip/src/TooltipTrigger.tsx#L57)

## 🧢 Your Company/Team

Chili Piper

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.