98 Subaru Outback brake/transmission?

The two times I have “slammed” on my brakes to avoid a collision in my 98 Subaru Outback, the automatic shift has slid forward into Park from Drive. The first time I thought it was my CD case going forward and hitting it, the second time it was not.