Skip to content

[css-anchor-position-1] Select the fallback position where more content is visible, not the last #9047

Closed
@tigrr

Description

@tigrr

When all fallback positions fail, the current spec tells to use the last fallback position.:

If the previous step finished without selecting a set of styles, use the adjusted styles corresponding to the final entry in the position fallback list.

This creates a strange behavior where a rather big element will be placed at a position where it is hardly visible on the screen, whereas other positions provided better visibility.

In this demo the anchor (pink) is close to the bottom of the page, so the anchored element (cyan) is hardly visible. If it was positioned on top, it would be mostly visible.

I propose changing the spec to select the fallback position which provided more element area to be visible on screen.

As next actions, the author may choose to limit the size of the anchored element to fit the screen.

Think dropdown with many items. It must be positioned under the trigger or above if there is more space above. Then dropdown's height may be limited to fit on the screen and cause scroll inside the dropdown menu.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Tuesday morning

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions