Skip to content
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

[Autocomplete][docs] The Tailwind code demo doesn't include item focus styles #80

Open
timbarclay opened this issue Jan 24, 2024 · 6 comments
Labels
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation

Comments

@timbarclay
Copy link

timbarclay commented Jan 24, 2024

Related page

https://mui.com/base-ui/react-autocomplete/

Kind of issue

Missing information

Issue description

The Tailwind autocomplete demo has visible focus on selected items, i.e. if you hover an item or used the up/down keys, items are visibly focused.

However, if you copy the code from the code sample into a project, or if you open the linked codesandbox, those visible focus states don't work and there's no visible feedback about which item is focused.

From the devtools, it looks like there are some extra css rules applied to the in-page demo that aren't in the code sample.

Context

I'm trying to use the base-ui autocomplete component with Tailwind in the way demonstrated on the page.

Search keywords: tailwind focus autocomplete base-ui

@timbarclay timbarclay added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 24, 2024
@timbarclay timbarclay changed the title [docs] [docs] [base-ui] The autocomplete code sample doesn't include item focus styles Jan 24, 2024
@danilo-leal danilo-leal changed the title [docs] [base-ui] The autocomplete code sample doesn't include item focus styles [base-ui][Autocomplete] The docs code demo doesn't include item focus styles Jan 24, 2024
@mj12albert mj12albert changed the title [base-ui][Autocomplete] The docs code demo doesn't include item focus styles [docs][base-ui][Autocomplete] The docs code demo doesn't include item focus styles Jan 25, 2024
@mj12albert
Copy link
Member

@timbarclay Thanks for reporting this ~ for those states we added custom static variants via Tailwind plugins, you can refer to the tailwind config for the demos here: https://github.com/mui/material-ui/blob/master/docs/tailwind.config.js

@mj12albert mj12albert removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 25, 2024
@mj12albert
Copy link
Member

We could update the CSB/Stackblitz creation to also copy the tailwind config if it's a tailwind demo

I'm not sure how to best communicate this for someone just copying and pasting the source though 🤔 CC @colmtuite @michaldudak @samuelsycamore

@colmtuite
Copy link
Contributor

I've been testing out React Aria the past few days, just to get a feel for their new Components product. They mention the Tailwind config in a lot of places throughout the docs and examples.
https://react-spectrum.adobe.com/react-aria/examples/user-combobox.html#tailwind-config

It feels quite cumbersome to me, compared to plain CSS demos which are just copy/paste. But I guess showing the config in the docs would be the right way to go.

@timbarclay
Copy link
Author

I think at the very least having a page that explains that before copying any of the Tailwind code samples, you need to make sure you have certain things set up in your config and making sure that page is linked from all the places where it gives those samples. I looked around to find something like that I didn't see anything.

@colmtuite
Copy link
Contributor

Yep I agree. I found https://mui.com/base-ui/guides/working-with-tailwind-css/ and https://mui.com/base-ui/getting-started/customization/ but I agree there should be more in-depth instructions on all the requirements.

@mj12albert mj12albert changed the title [docs][base-ui][Autocomplete] The docs code demo doesn't include item focus styles [docs][base-ui][Autocomplete] The Tailwind code demo doesn't include item focus styles Jan 25, 2024
@michaldudak michaldudak transferred this issue from mui/material-ui Feb 27, 2024
@michaldudak michaldudak changed the title [docs][base-ui][Autocomplete] The Tailwind code demo doesn't include item focus styles [docs][Autocomplete] The Tailwind code demo doesn't include item focus styles Feb 27, 2024
@michaldudak michaldudak changed the title [docs][Autocomplete] The Tailwind code demo doesn't include item focus styles [Autocomplete][docs] The Tailwind code demo doesn't include item focus styles Feb 27, 2024
@michaldudak michaldudak added component: autocomplete This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation bug 🐛 Something doesn't work labels Feb 27, 2024
@CelestialWorthy
Copy link

I did the hovering part here sandbox but not the moving up and down using the keyboard arrow keys part, do you suggest that i use the onKeyDown handler or are there other ways ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: autocomplete This is the name of the generic UI component, not the React module! docs Improvements or additions to the documentation
Projects
None yet
Development

No branches or pull requests

5 participants