Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

[MDCMenu] Menus overlapping MARGIN_TO_EDGE are cropped  #5603

@ghost

Description

Bug report

MDCMenu that is positioned near the bottom edge of the screen will get cropped to a thin line rather than being repositioned above the anchor. getOriginCorner_ doesn't use MARGIN_TO_EDGE, but getMenuSurfaceMaxHeight_ does, causing the inconsistency and cropping.

Steps to reproduce

  1. Create a menu that opens near the bottom of the screen where it would overlap MARGIN_TO_EDGE
  2. Notice how the menu is cropped instead of being repositioned above the anchor

Actual behavior

The menu gets cropped because of its max-height property

Expected behavior

The menu should be aligned BOTTOM instead of TOP.

Screenshots

Screen Shot 2020-02-13 at 1 35 58 PM

Your Environment:

Software Version(s)
MDC Web 5.0.0-canary.a1a0deb3e.0
Browser Chrome
Operating System OSX

Additional context

This was surfaced while using the web-components version of the MDCMenu but the error appears to be here.

Possible solution

getOriginCorner_ should take into account the MARGIN_TO_EDGE here:

const availableBottom = isBottomAligned ? viewportDistance.bottom - this.anchorMargin_.bottom
and reposition the menu above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions