Skip to content

useOverlayPosition: user-defined maxHeight is ignored when userSetMaxHeight < maxHeight #4474

Open
@LosYear

Description

@LosYear

🙋 Feature Request

I'm working on integrating react-aria into out existing project.

I'm looking for some motivation beneath this decision: #1500 (comment)

It's a common behaviour for us to let users scroll the page if the dropdown with e.g min-height: 300px can't be rendered into viewport. But calculated max-height seems to crop the popup/dropdown to fit the screen.

Although it can be solved either with setting maxHeight bigger that calculated or deleting max-height property from returned styles object, it can't be done that way because of this line:

Object.keys(position.position).forEach(key => (overlayRef.current as HTMLElement).style[key] = position.position[key] + 'px');

Is there any motivation beneath this decision that I'm not taking into consideration. Or can we somehow patch this place (e.g when maxHeight=null or smth like that) to handle this case?

I'm ready to submit a PR but wondering what way is preferred to handle it

–––
Another dirty dirty hack to overcome this problem is to set maxHeight: -Infinity

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions