-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
[Bug]: Label animations in shadowRoot not working #329
Comments
Hi, @Canabale. I see that in the codepen, that you’re still using the old version of materialize! Could you try the latest one? The CDNJS only contains the original work one. Ours are hosted at jsDelivr. |
Thanks for the quick response @Jerit3787. |
Hi @Canabale, yes indeed the included css & js files were the correct ones. This issue probably true due to the fact that Materialize haven't supported yet the 'shadowRoot' mechanisms/situations yet. Feel free to open up a pull request if you think that's okay. I can take a look from there. I really don't know how the inner code works, it might take time for others to help fix it :) |
You probably need to re-init the JS of the Labels: |
Have you tried it with the latest version 2.0.1-alpha? |
i added a codepen for version 2.0.1 It actually looks worse than before. Did i do something wrong? |
[](> >
It is actually working, now 😄 You must provide a placeholder with a blank space in order for it to work properly (see "Floating Labels with CSS only" in the docs). <html>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<body>
<m-element>
<div class="input-field">
<input id="email" type="email" placeholder=" ">
<label for="email">Email</label>
</div>
</m-element>
</body>
</html> UPDATE [1]: I'm already preparing a commit so the input fields will be able to display a custom placeholder (without floating labels) as well 😄 UPDATE [2]: Since you are working with "shadowRoot" (custom element), the new "dark mode" support will not let it to apply the proper colours (since the variables are mapped to |
Closing this issue since it has been resolved in #384. |
Before submitting...
Context
Hello there,
First: Thanks for this awesome library.
Second:
The label animations are not working if loaded in shadowRoot, even if delegatesFocus is enabled.
I opened a thread on stackoverflow with the code snippets showing the actual issue.
This CodePen contains the Bug.
This CodePen is for version 2.0.1
This CodePen contains my current workaround.
And this CodePen basically shows what i am trying to achieve as web component.
I think this might be a scoping problem, but i am not quite sure, because i don't really know the source code of this generally really awesome library.
If i can help fixing this: Best chances of contacting me are on stackoverflow or by responding here.
Kind regards,
Canabale
Current Behavior
The focus handling in shadowRoot components does currently not work correctly.
Therefore labels will not move, when entering an input element.
Expected behavior
Materialize in shadowRoot should work the same as in the html document itself.
Possible Solutions or Causes
The issue might be that the query selectors in materialize do not out the box query document fragments in shadowRoot.
This CodePen contains my current workaround.
Steps to reproduce
This CodePen contains the Bug.
This CodePen contains my current workaround.
And this CodePen basically shows what i am trying to achieve as web component.
Your Environment
The text was updated successfully, but these errors were encountered: