angular-ui / ui-scroll

Unlimited bidirectional scrolling over a limited element buffer for AngularJS applications

Home Page:http://angular-ui.github.io/ui-scroll/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

keyboard scrolling gets stuck when the focused element get destroyed

limingli0707 opened this issue · comments

Hi
We found the keyboard scrolling doesn't work well the ui-scroll. Basically, once the focused element gets destroyed, the keyboard scrolling doesn't work anymore due to the focus losing.
You can reproduce it in the example here: https://rawgit.com/angular-ui/ui-scroll/master/demo/scopeDatasource/scopeDatasource.html
You can click on any item, and use command + up/down, it works initially. Then once the element gets destroyed from the DOM, the focus gets lost and the keyboard scrolling doesn't work anymore.

Do you have any thoughts or workaround on this issue?
Thanks :)

If we are speaking of Chrome browser, then it seems the old issue. I opened bug in Chromium times ago, you may find latest updates here: https://bugs.chromium.org/p/chromium/issues/detail?id=493078.

Thanks for your reply. You're right, it seems a browser issue. Firefox is fine and Safari has the same issue.

@dhilt I think I just found a workaround about this. I'm using "tabindex=0" in the ui-scroll-viewport in the HTML in order to make it focusable. Once the dom gets rendered/re-rendered, manually focus on it. (viewportElem.focus()). For now I call the focus function in the datasource get call back in app level, will try to generalize it and create a PR to enhance the ui-scroll lib. Thanks for your help!

@limingli0707 Perhaps you may create a demo on stackblitz, here's the skeleton with the ui-scroll sources inlined: https://stackblitz.com/edit/angular-ui-scroll-v1-7-4-inline?file=app.js with 1771 lines of es5-generated code. Fork it, make updates and say which lines have been changed... maybe it would be easier.

Finally the fixed the issue in Chrome v104.