这是indexloc提供的服务,不要输入任何密码
Skip to content

Position::Fixed for viewport positioned elements #829

@BrandonDyer-Disney

Description

@BrandonDyer-Disney

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

There's no way, as far as I can tell, to have an element positioned relative to the viewport.

What solution would you like?

Add a Position::Fixed variant that would act, for all intents and purposes, the same as Position::Absolute, except relative to the viewport rather than most recent positioned ancestor.

Viewport being a rectangle with x and y being zero and size being available space passed into compute_root_layout().

What alternative(s) have you considered?

I have considered having an override in my own element nodes, but that seems unnecessary, and contrary to the purpose of using something like taffy.

Additional context

MDN docs: https://developer.mozilla.org/en-US/docs/Web/CSS/position#fixed

Related: #828

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions