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

It is need to know when menu will be rendered and had position #748

Open
Viktor-the-great opened this issue Dec 9, 2019 · 5 comments
Open

Comments

@Viktor-the-great
Copy link
Contributor

Viktor-the-great commented Dec 9, 2019

first of all sorry for my english

Input field is inside menu (Dropdown.Menu). There is a lot of text in front of the input field. Set focus on input field when menu is mounted. Menu has not yet received a position, so the page is scroll to the beginning (menu is hidden and is at the very top of the page).

I am now using timeout to fix it.
In demo scroll to bottom. There are two input button to open dropdown. Page scrolls up when first button is pressed. Second button use setTimeout to wait when menu get position.

I suggest using onCreate, onUpdate of Popper.js to solve this problem, and for this to pass these functions to the constructor (usePopper hook)

@taion
Copy link
Member

taion commented Dec 9, 2019

Pass in popperConfig to set detailed Popper options

@taion taion closed this as completed Dec 9, 2019
@Viktor-the-great
Copy link
Contributor Author

Viktor-the-great commented Dec 9, 2019

Pass in popperConfig to set detailed Popper options

I see only popperConfig.modifiers

const popper = usePopper(toggleElement, menuElement, {
placement,
enabled: !!(shouldUsePopper && show),
eventsEnabled: !!show,
modifiers: {
flip: { enabled: !!flip },
arrow: {
...(popperConfig.modifiers && popperConfig.modifiers.arrow),
enabled: !!arrowElement,
element: arrowElement,
},
...popperConfig.modifiers,
},
});

PopperJS accept:
Снимок экрана от 2019-12-10 01-15-37

@taion
Copy link
Member

taion commented Dec 9, 2019

ah, okay. this should spread in ...popperConfig as with <Overlay> then. can you send in a PR?

@taion taion reopened this Dec 9, 2019
@Viktor-the-great
Copy link
Contributor Author

yes I can

@taion
Copy link
Member

taion commented Dec 9, 2019

thanks!

Viktor-the-great pushed a commit to Viktor-the-great/react-overlays that referenced this issue Dec 9, 2019
Viktor-the-great pushed a commit to Viktor-the-great/react-overlays that referenced this issue Dec 10, 2019
* use options.popperConfig to initiate PopperJS
Viktor-the-great pushed a commit to Viktor-the-great/react-overlays that referenced this issue Dec 10, 2019
Viktor-the-great pushed a commit to Viktor-the-great/react-overlays that referenced this issue Dec 11, 2019
Viktor-the-great pushed a commit to Viktor-the-great/react-overlays that referenced this issue Dec 11, 2019
taion added a commit that referenced this issue Mar 4, 2020
* pass whole popperConfig to PopperJS (#748)

* pass whole popperConfig to PopperJS (#748)
* use options.popperConfig to initiate PopperJS

* pass whole popperConfig to PopperJS (#748)
* fixed pass popperConfig option

* Revert "pass whole popperConfig to PopperJS (#748)"

This reverts commit 453ff44

* use popperOptions in usePopper (#748)

Co-authored-by: Jimmy Jia <tesrin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants