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

Clicking the menu doesn't work correctly with scrollYOffset set #748

Closed
m-mohr opened this issue Dec 17, 2018 · 3 comments
Closed

Clicking the menu doesn't work correctly with scrollYOffset set #748

m-mohr opened this issue Dec 17, 2018 · 3 comments

Comments

@m-mohr
Copy link
Contributor

m-mohr commented Dec 17, 2018

I've got a ReDoc instance running with scrollYOffset set to an header element, see https://open-eo.github.io/openeo-api/v/0.4.0/apireference/index.html
Clicking on the menu items doesn't work in many cases, it is opening the correct menu item for a short period of time and then shows the one above it (may be even in another group). For example, you can try clicking "EO Data Discovery".

I think I found the issue while debugging a bit. The problem occurs if you specify an element for the scrollYOffset which el.getBoundingClientRect().bottom returns a non-integer number for. It seems that in some places it works on integers and in some on floating point numbers and this leads to imprecision when calculation the scrolling position and the active menu item. Using Math.ceil or Math.round in normalizeScrollYOffset solved the problem for me. So I'd suggest only allowing integers as scrollYOffset and ensure in code that it is always an integer.

Hope this can be solved soon, thanks in advance!

Some version numbers:
ReDoc version: 2.0.0-rc.0
Chrome: Version 70.0.3538.110 (Windows)

@m-mohr
Copy link
Contributor Author

m-mohr commented Jan 16, 2019

@RomanGotsiy Any news or plans on this?

@RomanHotsiy
Copy link
Member

Thanks for the investigation!
Fixed it now. Will be available in the upcoming rc.

@m-mohr
Copy link
Contributor Author

m-mohr commented Jan 17, 2019

Thanks!

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