Skip to content

Using display: none instead of visibility: hidden to hide elements in the complex DOM UI. #316

@lpardosixtosMs

Description

@lpardosixtosMs

Filing this issue to follow up on the discussion from the discussion in #308.

@julienw:

I wonder why you decided to use these rules for the closed expandable items: image
instead of display: none which is IMO more common. Do you have data about that? When debugging with Firefox' devtools, I can see that the invisible elements were still laid out. I wonder if this might be the cause of the extra slowness in Firefox. If this is common on websites I'll all for keeping it, but otherwise I think this should be changed to display: none so that it's not part of the layout (but still part of the restyle).

@lpardosixtosMs:

This is how the spectrum library is coded. We just used the is-open classname to control whether the item is expanded or not. We can override it if there is consensus that using display: none is better.

Performance-wise we can measure the impact of changing this rule, but that doesn't answer the questions:

  • Which one is more realistic?
  • Why use one against the other?

Here is a comment from our experts about the latter:

one reason to not use display: none is that, historically, it's not possible to transition/animate from that value. So, if you wanted to have an opening animation where the element grows in height or something like that you might avoid display: none.

Metadata

Metadata

Labels

non-trivial changeA change that affects benchmark results

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions