angular-ui / ui-sortable

jQuery UI Sortable for AngularJS
http://angular-ui.github.io/ui-sortable/
MIT License
1.26k stars 444 forks source link

Links inside sortable itens do not clear previous focus #520

Closed rodrigoyoshida closed 5 years ago

rodrigoyoshida commented 7 years ago

Hi.

I have a sorting list that is generated from an external JSON loaded asynchronously, each item has a link inside them that opens a modal using the UI Bootstrap $uibModal service. The problem is that whenever I close a modal, the page jumps to top making it hard to edit items that are on the bottom part of the page since I have to scroll down everytime I close a modal.

I already found what is causing it, for some reason the focus keeps on the button clicked before clicking on the link that opens the modal. If I disable the UI Sortable it works as expected, the button loses the focus when I click on the link.

Clicking on any part of the page (even a blank area) after clicking on the button prevents it from happening since it forces the button to lose the focus. Also changing the a link for a button works too but in my case I need a link there.

As a workaround, I manually forced it to lose the focus, but I know it's not recommended since it touches the DOM from a controller.

I created a Plunker to demonstrate the issue: http://plnkr.co/edit/LYzLdjNf45w4OEUUQZqw?p=preview

Hope I could help to fix this issue!

thgreasi commented 7 years ago

Thanks for the detailed report. That's really strange. I'm not sure how ui-sortable causes/affects this. It might be related to some part of the jquery-ui implementation.

rodrigoyoshida commented 5 years ago

I am closing this issue because I believe it will no longer be fixed.