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

HelperText doesn't render correctly when conditionally added #627

Open
tuckergordon opened this issue Sep 28, 2023 · 0 comments
Open

HelperText doesn't render correctly when conditionally added #627

tuckergordon opened this issue Sep 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tuckergordon
Copy link

tuckergordon commented Sep 28, 2023

Describe the bug
Textfield HelperText does not render in the correct location if placed inside an {#if}. Noticed this with CharacterCounter but I'm guessing a similar bug is causing #392 and possibly #245 (though that issue is pretty old at this point).

I have a hunch it could be related to #384 as well, as those are both situations where an element is conditionally rendered and some of the styles are not loaded correctly.

To Reproduce
Steps to reproduce the behavior:

Add HelperText to a Textfield inside a conditional, e.g.

export let charLimit = 18;

<Textfield label="Write a message..." input$maxLength={charLimit}>
  {#if charLimit}
    <CharacterCounter slot="helper" />
  {/if}
</Textfield>

Expected behavior
Character count displays below textfield

Screenshots
image

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome
  • Version ^7.0.0-beta.14

Additional context
For those running into a similar issue, you can use <svelte:fragment> as a workaround:

<Textfield label="Write a message..." input$maxLength={charLimit}>
  <svelte:fragment slot="helper">
    {#if charLimit}
      <CharacterCounter />
    {/if}
  </svelte:fragment>
</Textfield>
@tuckergordon tuckergordon added the bug Something isn't working label Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant