Attributes: Trim whitespace from option text when returned as a value

Fixes #14858
Ref #14686
Closes gh-1531