-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Composite: add Hover and Typeahead subcomponents #64399
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
decorators: [ | ||
( Story ) => { | ||
return ( | ||
<> | ||
{ /* Visually style the active composite item */ } | ||
<style>{ ` | ||
[data-active-item] { | ||
background-color: #ffc0b5; | ||
} | ||
` }</style> | ||
<Story /> | ||
<div | ||
style={ { | ||
marginTop: '2em', | ||
fontSize: '12px', | ||
fontStyle: 'italic', | ||
} } | ||
> | ||
{ /* eslint-disable-next-line no-restricted-syntax */ } | ||
<p id="list-title">Notes</p> | ||
<ul aria-labelledby="list-title"> | ||
<li> | ||
The active composite item is highlighted with a | ||
different background color; | ||
</li> | ||
<li> | ||
A composite item can be the active item even | ||
when it doesn't have keyboard focus. | ||
</li> | ||
</ul> | ||
</div> | ||
</> | ||
); | ||
}, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This decorator helps to visually identify the active composite item. It is particularly useful in the Hover
example, where composite items become "active" on hover without receiving keyboard focus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooo, helpful!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well and tests well, thanks @ciampo! ✅
I appreciate that this will help remove the direct Ariakit imports in dataviews 👏
100199b
to
4c1fab4
Compare
* Composite: add Hover and Typeahead subcomponents * Add hover example + styles to highlight active item * Add Composite.Hover props docs * Add Typeahead docs and Storybook example * CHANGELOG * Remove the `focusOnHover` and `blurOnHoverEnd` props. * Remove ariakit references * Add import statements to code examples --- Co-authored-by: ciampo <mciampini@git.wordpress.org> Co-authored-by: tyxla <tyxla@git.wordpress.org>
What?
Follow-up to #63564
Add
Composite.Hover
andComposite.Typeahead
componentsWhy?
To improve the offering of the
Composite
component.These components are also already used in the repository (imported directly from
ariakit
). Adding them toComposite
will allow us to replace those imports with imports from@wordpress/components
.How?
Testing Instructions
Composite
component, and play around with the newHover
andTypeahead
examplesThis PR doesn't include runtime changes to the actual component.