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

Nav ref does not work. #4012

Closed
winstonewert opened this issue Jul 9, 2019 · 3 comments · Fixed by #4031
Closed

Nav ref does not work. #4012

winstonewert opened this issue Jul 9, 2019 · 3 comments · Fixed by #4031

Comments

@winstonewert
Copy link

Using ref on Nav does not work.

Nav forwards the ref here:

https://github.com/react-bootstrap/react-bootstrap/blob/master/src/Nav.js#L93

But AbstractNav does not and instead sets up its own ref

https://github.com/react-bootstrap/react-bootstrap/blob/master/src/AbstractNav.js#L129

So the ref set on Nav goes nowhere.

@bpas247
Copy link
Member

bpas247 commented Jul 9, 2019

hmm, seems to be working fine in this example.

Either way it's probably more consistent if AbstractNav is changed to use React.forwardRef (or use one of the utility HOCs mentioned in this comment.

@winstonewert
Copy link
Author

winstonewert commented Jul 9, 2019

Ok, I misdiagnosed slightly.

The problem is that the ref gives me the AbstractNav component whereas I actually needed the <ul> DOM component.

@taion
Copy link
Member

taion commented Jul 9, 2019

Huh, I don't think there's any good reason we do that. Should we make <AbstractNav> also be a ref forwarder?

@bpas247 bpas247 added the bug label Jul 12, 2019
bpas247 added a commit that referenced this issue 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants