Skip to content

Popover: rework props around shift, filp and resize behavior #43191

Description

@ciampo

What

Tracked in #42770

Currently, Popover exposes two props for tweaking its behavior when intersecting with the viewport's boundaries:

  • __unstableForcePosition
  • __unstableShift

However, it feels like these props don't offer the correct abstraction and actually limit the flexibility of the component.

Proposed next steps

We could look at removing __unstableForcePosition and replacing it with separate resize and flip props, in order to be more aligned with floating-ui's middleware options.

Bonus: we should also look at https://ariakit.org/examples/popover, and try to make a potential refactor of the component to ariakit as simple as possible

Activity

  1. changed the title [-]We should understand what's the best API strategy for defining the Popover's behaviour when reaching the viewport boundaries — currently, the `Popover` component exposes the `__unstableForcePosition` and `__unstableShift` props. We should come up with a definitive API strategy (should we allow turning on/off `flip` and `shift` separately?) and remove those `__unstable` props[/-] [+]Popover: rework props around shift, filp and resize behavior[/+] on Aug 12, 2022
  2. added
    [Type] Enhancement
    [Feature] UI Components
    [Package] Components
    on Aug 12, 2022
  3. talldan commented on Aug 17, 2022

    @talldan
    Contributor

    It turns out I didn't need this to fix the issue with legacy widgets (#43297).

    But I can still push a PR that refactors this.

  4. talldan commented on Aug 17, 2022

    @talldan
    Contributor

    Bonus: we should also look at https://ariakit.org/examples/popover, and try to make a potential refactor of the component to ariakit as simple as possible

    Nearly forgot, I looked at how ariakit's popover works.

    It seems like that uses a fitViewport prop, which I guess is roughly the same as resize (though I don't know if 'viewport' is correct, but maybe that's just a nitpick):

    And there's a flip prop:

    So that may be another reason to still change the props.

  5. ciampo commented on Aug 17, 2022

    @ciampo
    ContributorAuthor

    Thank you for the exploration!

    But I can still push a PR that refactors this.

    That would be great!

  6. added
    [Status] In Progress
    on Aug 24, 2022
  7. ciampo commented on Aug 30, 2022

    @ciampo
    ContributorAuthor

    Reopening as the shift prop is still marked as __unstable — we should:

    • add a new shift prop with the same default value of __unstableShift
    • add a deprecation notice to __unstableShift

    @talldan , would you be able to work on this? It should be a quick one.

  8. reopened this on Aug 30, 2022
  9. ciampo commented on Sep 5, 2022

    @ciampo
    ContributorAuthor
  10. removed
    [Status] In Progress
    on May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] UI Components[Package] Components[Type] Enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions