Hi @dorilama thanks for your answer, I know that I should do :active pseudo class to style the css, but my problem is I don’t know how to do it in weweb.
I tried putting .classname:focus{ styles } in the “custom css” section but doesn’t work
My understanding is that the state is managed internally by weweb and is not automatically switched when you focus the input, like what happens for hover state.
For a “onfocus” workflow trigger to manage focus events you need to ask the weweb team.
If you use the workaround that I describe here you can activate your element state by binding the state condition.
In that example you keep track of the focused element updating a variable with the name of the element (the one in the settings panel), so you can bind the focus condition to that.
Something like this:
@Aurelie & @Flo is there a more “natural” HTML way to do this?
I thought the new states were solving this use case. Perhaps I misunderstood.
It’s seems like a lot of no-code to do such a simple thing.
Have a nice evening.
The default state style will cascade to all the states as is normal in HTML&CSS. You can specify styles for states such as hover that then will override the default state style. For example, on hover of a button you want to change the background color. If the style didn’t cascade you would have to set all the style again just to change the background color.
you can use the :focus pseudo-class in your CSS for styling active state for form fields. you can create new states for using states in WeWeb, but understanding how to utilize them is essential. Check out this article on hover effects in inline CSS