Skip to content

Conversation

@wrozka
Copy link
Contributor

@wrozka wrozka commented Dec 12, 2024

This PR imports file input styles from Flowbite and fixes display issue in Safari.

Current look of file inputs:
Screenshot 2024-12-12 at 16 23 00

File inputs after fix:
Screenshot 2024-12-12 at 16 23 22

plugin.js Outdated
width: '100%',
cursor: 'pointer',
overflow: 'hidden',
'border-radius': '.5rem',
Copy link
Contributor

@tagliala tagliala Dec 12, 2024

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

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Member

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
Copy link

codecov bot commented Dec 12, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.11%. Comparing base (bd735ef) to head (bd48e13).
⚠️ Report is 84 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wrozka
Copy link
Contributor Author

wrozka commented Dec 30, 2024

@javierjulio Did you have a chance to take a look at this PR? What do you think?

@aalyahya
Copy link
Contributor

Is there anything I can help with to get this PR merged? @tagliala @javierjulio

@tagliala
Copy link
Contributor

I'm sorry, the result looks good to me, but I can't approve this PR

@tagliala tagliala requested a review from javierjulio January 28, 2025 18:25
@tagliala tagliala mentioned this pull request Feb 26, 2025
@javierjulio
Copy link
Member

javierjulio commented Sep 22, 2025

@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 ::file-selector-button styles since it's offset. The block display and overflow hidden are unnecessary as an example.

javierjulio added a commit that referenced this pull request Sep 22, 2025
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.
@wrozka
Copy link
Contributor Author

wrozka commented Sep 23, 2025

Thanks, @javierjulio! I have to admit I just blindly copied the styles from Flowbite to fix it 😅

javierjulio added a commit that referenced this pull request Sep 23, 2025
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.
javierjulio added a commit that referenced this pull request Sep 23, 2025
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.
javierjulio added a commit that referenced this pull request Sep 26, 2025
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.
javierjulio added a commit that referenced this pull request Oct 3, 2025
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.
javierjulio added a commit that referenced this pull request Oct 3, 2025
* 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
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.

4 participants