-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Fix input file styles #8574
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
Fix input file styles #8574
Conversation
plugin.js
Outdated
| width: '100%', | ||
| cursor: 'pointer', | ||
| overflow: 'hidden', | ||
| 'border-radius': '.5rem', |
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.
Hi and thanks for this PR.
The border-radius seems off to me by taking a look at the screenshot, and it's confirmed because of .375rem in the other buttons
Can you please use the settings from the theme?
I can see
'border-width': borderWidth['DEFAULT'],in this file. Don't know exactly how. flowbite works. It looks like it is using rounded-md class
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.
@tagliala Thanks, done! I've updated the PR to use theme config as much as possible. I reviewed the file again and I've realised I could replace all those styles with just one big @apply:
[`[type='file']`]: {
@apply block w-full text-sm text-gray-900 border border-gray-300 rounded-lg cursor-pointer bg-gray-50 dark:text-gray-400 focus:outline-none dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 overflow-hidden;
}
Do you have preferred style? I've seen both inlines and applies in this file.
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.
Thanks
Do you have preferred style?
Can't tell exactly, not my expertise, let's wait for @javierjulio 's review, I guess it should be a mix of both but I can't tell exactly what should be in a class and what in that definition
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.
The issue is mostly the ::file-selector-button styles since it's offset. For example, the block display and overflow hidden are unnecessary. Since it's not addressed here, I'd rather tackle that and keep the styles simpler, matching the base text input instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #8574 +/- ##
=======================================
Coverage 99.11% 99.11%
=======================================
Files 141 141
Lines 4076 4076
=======================================
Hits 4040 4040
Misses 36 36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@javierjulio Did you have a chance to take a look at this PR? What do you think? |
|
Is there anything I can help with to get this PR merged? @tagliala @javierjulio |
|
I'm sorry, the result looks good to me, but I can't approve this PR |
|
@wrozka thank you for opening this as I wasn't aware of it and for your patience. I will address this in a new PR (edit: #8809) that finishes the dark mode styles for form controls which were incomplete. The issue here is actually with the |
Since these were taken from Flowbite to start, there are several issues. The ::file-selector-button was offset and wasn't rendered correctly. The offset was to add spacing between the button and generated browser text that we can't style. It would be preferred as a default to not offset. This applies same styles as other input controls to keep it simple and consistent. The :focus style was removed since it was invalid anyway and not applied by the browser. This was partially addressed in #8574 but not targeting the right element. This approach is preferred to simplify the styles as the fix in #8574 (display block and overflow hidden) are unnecessary and cause undesired effects e.g. no border radius visible on left side of button.
|
Thanks, @javierjulio! I have to admit I just blindly copied the styles from Flowbite to fix it 😅 |
Since these were taken from Flowbite to start, there are several issues. The ::file-selector-button was offset and wasn't rendered correctly. The offset was to add spacing between the button and generated browser text that we can't style. It would be preferred as a default to not offset. This applies same styles as other input controls to keep it simple and consistent. The :focus style was removed since it was invalid anyway and not applied by the browser. This was partially addressed in #8574 but not targeting the right element. This approach is preferred to simplify the styles as the fix in #8574 (display block and overflow hidden) are unnecessary and cause undesired effects e.g. no border radius visible on left side of button.
Since these were taken from Flowbite to start, there are several issues. The ::file-selector-button was offset and wasn't rendered correctly. The offset was to add spacing between the button and generated browser text that we can't style. It would be preferred as a default to not offset. This applies same styles as other input controls to keep it simple and consistent. The :focus style was removed since it was invalid anyway and not applied by the browser. This was partially addressed in #8574 but not targeting the right element. This approach is preferred to simplify the styles as the fix in #8574 (display block and overflow hidden) are unnecessary and cause undesired effects e.g. no border radius visible on left side of button.
Since these were taken from Flowbite to start, there are several issues. The ::file-selector-button was offset and wasn't rendered correctly. The offset was to add spacing between the button and generated browser text that we can't style. It would be preferred as a default to not offset. This applies same styles as other input controls to keep it simple and consistent. The :focus style was removed since it was invalid anyway and not applied by the browser. This was partially addressed in #8574 but not targeting the right element. This approach is preferred to simplify the styles as the fix in #8574 (display block and overflow hidden) are unnecessary and cause undesired effects e.g. no border radius visible on left side of button.
Since these were taken from Flowbite to start, there are several issues. The ::file-selector-button was offset and wasn't rendered correctly. The offset was to add spacing between the button and generated browser text that we can't style. It would be preferred as a default to not offset. This applies same styles as other input controls to keep it simple and consistent. The :focus style was removed since it was invalid anyway and not applied by the browser. This was partially addressed in #8574 but not targeting the right element. This approach is preferred to simplify the styles as the fix in #8574 (display block and overflow hidden) are unnecessary and cause undesired effects e.g. no border radius visible on left side of button.
* Update form control dark mode styles Now using darker colors for background-color, color and border-color styles. * Fix file input styles Since these were taken from Flowbite to start, there are several issues. The ::file-selector-button was offset and wasn't rendered correctly. The offset was to add spacing between the button and generated browser text that we can't style. It would be preferred as a default to not offset. This applies same styles as other input controls to keep it simple and consistent. The :focus style was removed since it was invalid anyway and not applied by the browser. This was partially addressed in #8574 but not targeting the right element. This approach is preferred to simplify the styles as the fix in #8574 (display block and overflow hidden) are unnecessary and cause undesired effects e.g. no border radius visible on left side of button. * Fix placeholder style This now uses a single text-gray-500 for both light and dark modes using the correct Tailwind syntax. * Consolidate input color/spacing styles * Simplify checkbox and radio styles Originally, this required different background sizes due to the checkbox SVG but all 3 SVGs now account for being within a padded square box so we can now set a single background size of 100% for both elements. The checkbox SVGs had to be recreated for that. This also removes a duplicate rule (.dark [type='radio']:checked) because of CSS specificity which we no longer need. * Set attribute-table row to baseline align For an attribute with multi line text (e.g. comment body), we want the column header to align to the top or specifically the baseline of the parent. This way the column text aligns nicely with the value text. * Update attributes-table dark mode styles The attributes table heading dark mode color was too bright so this darkens it and is a nice contrast to mimic what its like in light mode. The empty value text is lighter now in dark mode too since it wasn't as visible. * Adjust action-item-button dark border color * Update batch actions dropdown dark colors * Update form errors/inline-errors styles This also updates the inline-errors to include the select element. * Update devise templates with darker panel bg color * Update flash message icon colors The SVG's use currentColor so it applies the (text) color of the parent element. We can further control this and for dark mode to make these nicer and standout. * Update panel title dark bg color * Add dark styles to kitchen sink sample sidebar * Update scopes-count colors * Update status-tag colors * Update user menu color styles * Update sample modal template dark mode colors
This PR imports file input styles from Flowbite and fixes display issue in Safari.
Current look of file inputs:

File inputs after fix:
