backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

[DX] Add CSS classes to form elements that are hidden/shown via #states. #1969

Open klonos opened 8 years ago

klonos commented 8 years ago

I was trying to figure out a way to solve #1968, but I see no way to target all these elements effectively in a single CSS rule. It would be easy if the #states elements had a generic .has-states class and perhaps also a second class with the specific state per element case. So a .states-[state] class where [state] would be one of:

Perhaps also a .states-lvl-x class if possible (where x is the numeric level of how many parent elements the element in question has).

I would file a PR, but this touches the Field API and I am not even remotely ready for than yet, so I rely on somebody else to tackle this. Once implemented, I think it will be easy(ier) for me to sort #1968

klonos commented 8 years ago

...this looks like an API change, but I think it might be OK since it is an API addition.