Merge pull request #129 from muffinresearch/centralise-focus-863328

Centralize focus handling (bug 863328)
Make pin form provide type attr (bug 874470)