Run a trim on the title before setting the title attribute on the button

Fixes problems with strangely formatted title boxes.