Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Popover, Dropdown, PopoverEducational: support forcePosition prop #3744

Merged
merged 6 commits into from
Oct 8, 2024

Conversation

AlbertCarreras
Copy link
Contributor

@AlbertCarreras AlbertCarreras commented Sep 10, 2024

BREAKING CHANGE:

We are deprecating idealPosition: forceDown

yarn codemod detectManualReplacement ~/path/to/your/code
--component=Popover or Dropdown or PopoverEducational
--prop=idealDirection
--value=forceDown

Popover, Dropdown, PopoverEducational: support forcePosition prop

Test example here: https://deploy-preview-3744--gestalt.netlify.app/web/popover#Ideal-direction

@AlbertCarreras AlbertCarreras requested a review from a team as a code owner September 10, 2024 17:26
@AlbertCarreras AlbertCarreras added the minor release Minor release label Sep 10, 2024
Copy link

netlify bot commented Sep 10, 2024

Deploy Preview for gestalt ready!

Name Link
🔨 Latest commit 14eb0ba
🔍 Latest deploy log https://app.netlify.com/sites/gestalt/deploys/66e08132fc9c6e0008b8c0da
😎 Deploy Preview https://deploy-preview-3744--gestalt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Sep 10, 2024

Deploy Preview for gestalt ready!

Name Link
🔨 Latest commit 75a991c
🔍 Latest deploy log https://app.netlify.com/sites/gestalt/deploys/670541316b9bdf000816c68f
😎 Deploy Preview https://deploy-preview-3744--gestalt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@diyorbek
Copy link
Contributor

@AlbertCarreras I think we should reconsider the API for force positioning. What if we'll need forceLeft, forceUp in the future? I would suggest to introduce forceDirection: boolean prop which will just disable auto-flipping/positioning behavior. We could just get rid of "force" prefixed positions.

@diyorbek
Copy link
Contributor

The new prop doesn't have to be forceDirection. It could be disableAutoFlip or something like that. The point is this props will disable the auto-flipping beahvior of the popover.

@AlbertCarreras AlbertCarreras changed the title Popover, Dropdown, PopoverEducational: support for forceDown and forceRight Popover, Dropdown, PopoverEducational: support forcePosition prop Oct 7, 2024
@AlbertCarreras AlbertCarreras added the major release Major release label Oct 7, 2024
let placement: Placement = direction ?? 'bottom';
const isRtl = typeof document === 'undefined' ? false : document?.dir === 'rtl';

if (isRtl && direction === 'left') {
Copy link
Contributor

@diyorbek diyorbek Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlbertCarreras have you tested this bahvior? I thought @floating-ui library already handled RTL. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might flip accordingly... but if we force behavior idk... I'll test it anyways.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tested it... no, when forced... it stays i the right/left, cos they don't do end/start and we read LRT/LTR from the document

Copy link
Contributor

@diyorbek diyorbek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@AlbertCarreras AlbertCarreras merged commit 387eef8 into pinterest:master Oct 8, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major release Major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants