solidjs-community / solid-aria

A library of high-quality primitives that help you build accessible user interfaces with SolidJS.
Other
289 stars 16 forks source link

Draft: feat(tooltip): create Tooltip #79

Open alveshelio opened 1 year ago

alveshelio commented 1 year ago

This PR is dependent of https://github.com/solidjs-community/solid-aria/pull/73 since it has changes to createFocusable

This is the port of Tooltip.

TODO

This is my first contribution to the project. I am looking for feedback.

I have pretty much followed what @react-aria/tooltip is doing.

I'm having a Typescript error with the return of createTooltipTrigger. I'm getting this error:

Types of property 'onFocus' are incompatible. 
Type 'EventHandlerUnion<any, 
FocusEvent> 
| EventHandlerUnion<HTMLElement, FocusEvent>
| undefined' is not assignable to type '((e: FocusEvent) => void) | undefined'.

Looking at the signature of onFocus from FocusEvents => onFocus?: (e: FocusEvent) => void; in @solid-aria/types, this is exactly the same signature as we have in @react-aria/types. In their implementation of onFocus, they are not passing the event to onFocus and it is not complaining in @react-aria

Looking at createFocusable interface FocusableResult, focusableProps: JSX.HTMLAttributes<any>; and onFocus in HTMLAttributes is indeed onFocus?: EventHandlerUnion<T, FocusEvent>;

@fabien-ml I see you worked in createFocusable, do you think you could help me out?

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 099f349e8b044b1a7a41bc7f946778ea6f211216

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

fabien-ml commented 1 year ago

EventHandlerUnion is the correct event type in Solid, I think the one from FocusEvents has to be the same, however i'm not sure how this will impact others packages