Skip to content

Setting the visibility of UI nodes is confusing and redundant #5368

@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

The visibility of UI entities can be controlled in two distinct ways: via the Style component's field, and by setting Visibility (you could also muck with ComputedVisibility but please don't).

This is both confusing, and results in inconsistent behavior (see #5360 and the resulting #5361).

What solution would you like?

Remove the Display field of Style, and let users set this via the Visiblity component instead. In the interface with taffy, construct the taffy::Style struct information based on the combination of these components.

This is simple, allows for direct querying and is much more consistent with the rest of the engine.

What alternative(s) have you considered?

  1. Use Display as the canonical representation. This is confusing, and ties us tightly to CSS's model rather than being modular. It's also very inconsistent with the way visibility is handled elsewhere.
  2. Automatically sync these. This has non-zero computational costs and serious complexity (and bug-risk) costs, for no apparent benefit.

Additional context

Prompted by @mockersf complaining about this in #5361 (comment) <3

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-UIGraphical user interfaces, styles, layouts, and widgetsC-DocsAn addition or correction to our documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions