matrix-input.js no longer stops propagation of click events

Summary: The iOS app was unable to detect clicks on input elements for matrix-related khan-exercise
problems because the matrix-inputs were calling `e.stopPropagation()`. I've refactored some of the
code to get rid of that call while retaining the same behavior.

Test Plan:
- Run khan-exercises.
- Go to "matrix_inverse_2x2.html".
    - Try clicking in the bottom-right corner of the matrix. The box should expand to the 3x3 matrix.
    - Try clicking on the page (without typing anything). The box should contract to the 1x1 matrix.
    - Click again on the bottom-right corner and type something. Click elsewhere. The box should remain as a 3x3.
    - Complete the item and go on to the next; verify that the behavior persists (i.e., events are properly unbound and re-bound).

Auditors: eater