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

Apply button styles to file selector button #106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lfuelling
Copy link
Contributor

@lfuelling lfuelling commented Dec 19, 2024

Hi,

this PR applies the existing button styles to the file selector button and adds a documentation section about that:

Screenshot of the documentation pages showing the styled file input.

The ::file-selector-button selector is supported by all major browsers.

Thanks

Copy link

vercel bot commented Dec 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
7css ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 19, 2024 3:25pm

@@ -1,5 +1,6 @@
button,
[role="button"] {
[role="button"],
input[type="file"]::file-selector-button {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes a regression to the existing buttons, from the preview deployment, you can see all buttons are no longer interactive when hovered, clicked etc.

I have played around with this a little bit and here are some discoveries:

  • As a pseudo-element itself, ::file-selector-button cannot nest other pseudo-elements like ::before or ::after, nor can it work like a normal button element.
  • There are also no :disabled or :focus pseudo-classes, only :hover

Given, I'd suggest separating the file selector button to avoid giving the postcss-nested plugin grief and facing unexpected errors during build.

We may consider installing this postcss-extend-rule plugin to reuse the applicable styles from the normal button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants