Change your method for displaying the detail data next to the portal. My best guess is that you are using Go to Related Record or a scripted find to find a record to show the detail infoe. The change in record would then be what makes the portal "snap back".
If you use fields that refer to a related table occurrence via a relationship that is updated by your "click the portal row" script, You stay on the same record and this may keep your portal from "snapping back".
The unknown quantity here is that commit record may also trigger this change in the portal. You'll need to experiment and see. If you can't avoid the commit record and the portal is snapping back on the commit, your only other option is an imperfect "scroll back to the record" method that brings the clicked portal row back into view, but not in the exact same position that it had when you clicked the portal row.