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

fix(Input): Use a reactive spread instead of custom action to set Input type attribute #921

Merged

Conversation

Not-Jayden
Copy link
Contributor

@Not-Jayden Not-Jayden commented Jul 13, 2023

πŸ“‘ Description

Adjust the way the type attribute is set to use a reactively spread object rather than a custom action to circumvent the svelte warning. The motivation for this change is that currently the border is dependent on a type attribute being set on the input, which gets its styling from the global Flowbite CSS file.

This causes a brief flicker in the input's border given the attribute is being set with javascript after it first mounts, and just doesn't render a border at all if JS is disabled.

With the reactive spread, the input does have the type attribute already set on mount so the border will be present even without JS.

Status

  • Not Completed
  • Completed

βœ… Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • I have checked the page with https://validator.unl.edu/
  • All the tests have passed
  • My pull request is based on the latest commit (not the npm version).

β„Ή Additional Information

Also not sure if the border class should just be added in the defaultClass as well, but this is a less breaking change.

@stackblitz
Copy link

stackblitz bot commented Jul 13, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel
Copy link

vercel bot commented Jul 13, 2023

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
flowbite-svelte βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 13, 2023 9:26am
flowbite-svelte-update βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jul 13, 2023 9:26am

@Not-Jayden Not-Jayden changed the title fix: Add border class to Input defaultClass Use a reactive spread instead of custom action to set Input type attribute Jul 13, 2023
@Not-Jayden Not-Jayden changed the title Use a reactive spread instead of custom action to set Input type attribute fix: Use a reactive spread instead of custom action to set Input type attribute Jul 13, 2023
@Not-Jayden Not-Jayden marked this pull request as ready for review July 13, 2023 09:26
@Not-Jayden Not-Jayden changed the title fix: Use a reactive spread instead of custom action to set Input type attribute fix(Input): Use a reactive spread instead of custom action to set Input type attribute Jul 13, 2023
@jjagielka
Copy link
Contributor

That's a neat trick. Let's use it. Please approve.

@shinokada shinokada merged commit 165e273 into themesberg:main Jul 14, 2023
3 checks passed
@LahTeuto
Copy link

Wouldn't this change make sense for FloatingLabelInput.svelte too? The same custom action is used there that was replaced here.

@jjagielka
Copy link
Contributor

Yes, it would. @Not-Jayden can you make the same change at FloatingLabelInput.svelte?

@Not-Jayden
Copy link
Contributor Author

Yes, it would. @Not-Jayden can you make the same change at FloatingLabelInput.svelte?

Done :) #927

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.

None yet

4 participants