Lundalogik / lime-elements

Provides reusable web components for Lime CRM
https://lundalogik.github.io/lime-elements/versions/latest
Other
38 stars 13 forks source link

Title in lime-input(text-area) behaves differently with and without focus #1511

Closed terryilebode6 closed 2 years ago

terryilebode6 commented 2 years ago

Current behavior

The title text moves from the top of the input field, to inside the input field when the cursor is no longer focused on it , it sometimes jumbles up with the test

Steps to reproduce the behavior:

  1. add an input field with title to a modal, in my case my input field was a web component i passed to a schema

Expected behavior

Environment

https://user-images.githubusercontent.com/60092998/148730633-f0d9a6e8-b319-4a4b-9142-1d6259226007.mov

adrianschmidt commented 2 years ago

If you really are using Lime Elements v31.x, while only from April 2021, a lot has happened since then, so I would suggest upgrading. But:

If you're using this inside the Lime CRM Web Client, the version of Lime Elements used is decided by the web client, not your package, so you need to check there. When logged in, open the browser dev tools, go to the Console tab, and write Lime.versions, press enter and inspect the returned object.

terryilebode6 commented 2 years ago

thanks @adrianschmidt , will try that out and give feedback

adrianschmidt commented 2 years ago

@terryilebode6 Did you have a chance to look into this again? Did it resolve itself with an update or something, or is it still a problem?

terryilebode6 commented 2 years ago

@adrianschmidt haven't Checked yet, got stuck on a cycle bug, but it's top of my list today.

adrianschmidt commented 2 years ago

No worries. Just wanted to check if perhaps it had been resolved and you had forgotten to tell us. We've got this issue in our inbox until there's some actionable info 🙂

terryilebode6 commented 2 years ago

Screen Shot 2022-01-17 at 17 10 52 I tested this out with these versions and the bug is still there... I could help reproduce it , if that is necessary

adrianschmidt commented 2 years ago

I'm thinking this has something to do with the value not being updated as it should be, possibly because of a missing change handler or something. Can you link to the code where the limel-input is used?

terryilebode6 commented 2 years ago

the webcompenent : https://github.com/Lundalogik/limepkg-consent/blob/2888a0370bdc443e660d20a2dda74e9b0b711cab/frontend/src/components/lwc-limepkg-consent-text-area/lwc-limepkg-consent-text-area.tsx#L7

I use it in a schema : https://github.com/Lundalogik/limepkg-consent/blob/2888a0370bdc443e660d20a2dda74e9b0b711cab/limepkg_consent/bulk_consent/schema.py#L59

jgroth commented 2 years ago

You should not have to create your own web component just to have a text area. You are also not implementing a lot of properties from the FormComponent interface in your component. You should at least implement value and change, otherwise the component will not work when used in the form.

If you don't want to create your own web component, you can just use something like this in the schema instead. This will use the default component for text fields (which is limel-input-field) and set type to textarea

class Schema:
    note = fields.String(
        metadata={
            "title": note_localname,
            "lime": {
                "component": {
                    "props": {
                        "type": "textarea"
                     }
                }
            }
adrianschmidt commented 2 years ago

I'm guessing Johan's comment will be enough for you to solve the problem, so I'm closing this. Feel free to comment further on it though, if you need any further assistance, or just ping us in Slack.

terryilebode6 commented 2 years ago

initially tried it without the component, but found out that when I tried to set the text-area-heigh style property, it was ignored , can I set that property from outside the component(using the above suggested method)?

jgroth commented 2 years ago

I'm not sure but you could try and just set the style as another prop, e.g.

{
    "props": {
        "type": "textarea",
        "style": "--textarea-height: 25em"
    }
}

The preferred way is probably to use a layout instead as described in the docs https://lundalogik.github.io/lime-elements/versions/34.1.0/#/component/limel-form/

I.e. you should set a rowSpan

{
    "component": {
        "props": {
            "type": "textarea",
        },
    },
    "layout": {
        "rowSpan": 2,
    },
}