-
Notifications
You must be signed in to change notification settings - Fork 222
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
Use popper #299
Use popper #299
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good
src/DropdownMenu.js
Outdated
import DropdownContext from './DropdownContext'; | ||
|
||
export function useDropdownMenu(options = {}) { | ||
// const prevProps = usePrevious(props); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
i guess this is all in usePopper
now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I think it's unneeded here now, but i need to try in RB to confirm
src/Dropdown.js
Outdated
import PropTypes from 'prop-types'; | ||
import uncontrollable from 'uncontrollable'; | ||
import useUncontrolled from 'uncontrollable/hook'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrade uncontrollable
Hi @jquense do you need some help with this? |
happy to get some help if you wanna jump in I'm just a bit short on time at the moment |
This comment has been minimized.
This comment has been minimized.
src/Dropdown.js
Outdated
|
||
if (show && !prevOpen) { | ||
this.maybeFocusFirst(); | ||
if (focusStype == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to useMemo
this outside of this callback? I don't think this needs to be calculated on-the-fly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in practice it only runs on show so it's probably fine
focusInDropdown.current = false; | ||
focusToggle(); | ||
} | ||
// only `show` should be changing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to guard and check the previous value of show
anyway?
const handleClose = e => { | ||
if (!context.toggle) return; | ||
|
||
context.toggle(false, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
context.toggle(false, e); | |
context.toggle?.(false, e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional chaining plugin is not specified in babel config
} | ||
|
||
const handleClose = e => { | ||
if (!context.toggle) return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!context.toggle) return; |
Co-Authored-By: Jimmy Jia <[email protected]>
Is this ready to merge guys? |
I think done