iron-list icon indicating copy to clipboard operation
iron-list copied to clipboard

Add some kind of warning about the hidden attribute, or use display none

Open srcrip opened this issue 7 years ago • 0 comments

I recently got bitten by the hidden attribute when working with an iron-list, pretty bad. I'm much more of a back end developer, but I still try to do as much front end as I can.

Being one who has much less experience with front end work, hidden was news to me. I found this link explaining that it has very low specificity, so if you set display on your templates, it'll override hidden.

I would argue that it'd be very, very easy for a developer to set display on their template without thinking that this could cause iron-list to function incorrectly.

I think by default, the iron-list component should do something like this:

[hidden] { display: none !important}

If that's unacceptable, then iron-list should just set display: none when it intends to hide something. I love the idea behind using hidden, if it were to work well, but the fact of the matter is, with hidden being less specific then display, you create a situation where developers can bite themselves extremely easily. So it doesn't work well at all. If hidden isn't a realistic choice then it's not a good choice, when there's a perfectly acceptable better choice available.

If either of those choices are unacceptable I think there needs to be some sort of warning about this either on Github or the web components website.

srcrip avatar Mar 26 '18 23:03 srcrip