-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[Autocomplete] Fix keyboard navigation when using custom popover #35160
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
Conversation
|
Thanks, at first glance it seems to be working well. I've got one remark on the test, however. Instead of verifying if a certain CSS property is set, it would be better to test if the selected item is visible (the outcome that's visible to the end-user). You could verify if the |
thanks for quick review @michaldudak, updated test case as described |
hi @michaldudak i've updated test as described, also created another PR (#35196) which fixes similar navigation bug. can you review that when you get time |
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.
All good now. Thanks for your work!
Oh, nice detail. I have learned something today: the parent offset !== scroll container. I see Joy UI already has this style applied so is not impacted. We could have solved this without CSS: by using |
fixes: #34998
working proof: https://www.loom.com/share/8641a1e8a33844b0a48bff6e0d392289
Issue: element.offsetTop from below code returns incorrect value if parent element doesn't have relative position . attached some references below on this
material-ui/packages/mui-base/src/AutocompleteUnstyled/useAutocomplete.js
Lines 376 to 389 in c789ca6
https://stackoverflow.com/questions/29277608/jquery-offset-top-returns-wrong-value-error-with-margin#:~:text=if%20you%20try%20to%20get,will%20get%20a%20wrong%20value.&text=Try%20removing%20the%20margin%2Dtop,will%20see%20it%20will%20work.
https://medium.com/@alexcambose/js-offsettop-property-is-not-great-and-here-is-why-b79842ef7582.
So i've added position relative to parent element and added test.