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

fix(AbstractNav): allow passed in refs to be properly forwarded #4031

Merged
merged 8 commits into from
Aug 9, 2019

Conversation

bpas247
Copy link
Member

@bpas247 bpas247 commented Jul 10, 2019

Abstract Nav should be forwarding its ref to the underlying component, so that Nav (and any other components using this) can get the proper ref.

Fixes #4012.

src/AbstractNav.js Outdated Show resolved Hide resolved
src/AbstractNav.js Outdated Show resolved Hide resolved
src/AbstractNav.js Show resolved Hide resolved
src/AbstractNav.js Outdated Show resolved Hide resolved
Co-Authored-By: Jimmy Jia <tesrin@gmail.com>
@bpas247

This comment has been minimized.

bpas247 added a commit that referenced this pull request Jul 27, 2019
Migrate Input and List Group components to properly forward
passed in refs to the underlying component.

Also, replace HOC functionality with custom hooks.

Relevant to #4012 and #4031.
This reduces the complexity of the AbstractNav implementation,
especially in regards to how the contexts are integrated with it.
This fixes the assertion issues caused by the selectors testing
implementation details to find the DOM elements, rather than
testing for something that is gauranteed to be in the
implementation (E.g. the class `nav` on the Nav component, since
it's part of the Bootstrap design spec) of the rendered DOM
element.
Currently, we use a ref to gain access to the underlying
component to implement our own functionality. However, this causes
an issue with not allowing the user to forward their own ref
to gain access to the underlying component. using `useMergedRefs`,
we are able to forward both refs to the underlying component.
@bpas247 bpas247 requested review from jquense and taion July 27, 2019 07:59
@bpas247
Copy link
Member Author

bpas247 commented Jul 27, 2019

(Just a side-note, we should consider releasing useMergedRefs as a standalone package, it's a pretty useful hook 👀)

Copy link
Member

@taion taion left a comment

Choose a reason for hiding this comment

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

@jquense any reason why useMergedRefs isn't in @restart/hooks?

@bpas247 bpas247 changed the title fix: Abstract Nav forwarding ref fix(AbstractNav): allow passed in refs to be properly forwarded Aug 9, 2019
@jquense
Copy link
Member

jquense commented Aug 9, 2019

no reason, we should probably put it there!

@taion
Copy link
Member

taion commented Aug 9, 2019

i updated this to use restart/hooks; merging so i can cut a release

@bpas247
Copy link
Member Author

bpas247 commented Aug 9, 2019

Thinking we’ll need to update react-overlays to use usedMergedRefs from @restart/hooks rather than its local implementation of it.

@taion
Copy link
Member

taion commented Aug 9, 2019

sure, but we can do that later

@taion taion merged commit bda567f into master Aug 9, 2019
@taion taion deleted the fix/abstract-nav-ref-forwarder branch August 9, 2019 21:30
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

Successfully merging this pull request may close these issues.

Nav ref does not work.
3 participants