MelleD / lovelace-expander-card

Expander card for HomeAssistant
Apache License 2.0
33 stars 4 forks source link

Collapse child expanders #196

Open Kagey-cmd opened 1 month ago

Kagey-cmd commented 1 month ago

I am using nested Expander cards. When I collapse the parent, I'd like the children to also collapse, so that next time I expand the parent, the children are collapsed again. Currently, the child Expander cards retain the expanded/collapsed state they had before the parent was collapsed.

MelleD commented 1 month ago

You can use expanded: true or min-width-expanded or max-width-expanded for your start state.

Kagey-cmd commented 1 month ago

@MelleD yes, but none of those do what I'm asking.

MelleD commented 1 month ago

Do you have an example of a UI that does this?

As I said, you can set all child entities to expanded at the beginning. If you then open and close it, the state is set by the child expander and is self contained. I don't know whether usability will really be improved if the parent takes over the state afterwards.

Kagey-cmd commented 1 month ago

Yes, basically all UIs work this way.

Let's take your browser bookmarks bar, for example: You can place folders on your bookmarks bar, then you nest folders in those folders, and so on. When you expand the parent folder, all child folders are collapsed until you expand them in turn. If you then collapse the parent folder and then reopen it, the child folders are once again collapsed. If the parent is collapsed, the children revert to a collapsed state. File Explorer works this way. Processes page of Task Manager works this way. All social media UI works this way.

I understand there is the possibility of a use case in which you'd like the children to be expanded when you expand the parent, but I think this is a more rare scenario than the opposite. In any case, that's what expanded:true could control. In effect, collapsing the parent Expander should be treated like a page close/refresh from the perspective of the children, imo.

MelleD commented 1 month ago

I only know UIs that behave exactly as they currently do (MacOS). E.g. the latest status (closed/open) of the folders is always displayed in the Finder. No matter what you do with the parent folder.

I also tried E-Mail application like Outlook. Do exactly the same the last state of the child is used. I can also check google application, but I think they also do the same.

MelleD commented 1 month ago

I've now gone through all my programs. Not one of them behaves the way you describe.

All behave the same, if the parent expander is closed and opened again, all child expanders have the previous state

MelleD commented 4 weeks ago

@Kagey-cmd can you send an example? Or should we close this ticket?