15A244d: Selectable NSTextField with NSAttributedString loses styling on selection

Originator:francesc.bgr
Number:rdar://22222249 Date Originated:11-Aug-2015 01:39 AM
Status:Open Resolved:
Product:OS X SDK Product Version:15A244d
Classification:UI/Usability Reproducible:Always
 
Summary:
If a selectable NSTextField is created and it's displaying an NSAttributedString via the attributedStringValue, it loses its styling attributes on selection, turning the NSTextField styling into the system default.

Steps to Reproduce:
1. Download the attached Xcode project and run the default Mac target
2. Try to select the Hello World string

Expected Results:
1. The Hello string part is rendered in red and using the Avenir font
2. The world string part is rendered in green and using the American Typewriter font

Actual Results:
1. The Hello World string is selected, however it's rendered using the default system font. In 10.11 that's San Francisco and in the default control color, thus, discarting any kind of attributes passed through the NSAttributedString.

Version:
OS X: 10.11 15A244d
Xcode: Version 7.0 beta 5 (7A176x)

Notes:
Attached please find a sample project reproducing this issue.

Configuration:


Attachments:
'NSAttributedSample.zip' was successfully uploaded.

Comments

Try setting allowsEditingTextAttributes to true


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!