Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Blue Highlighting / Focus Ring on Catalyst App

I'm currently in the process of porting my iOS app to macOS using Project Catalyst.

All of my text fields, text views and table views have a blue outline when active.

I've noticed it in Apple Catalyst apps (e.g. News) in recent betas so I'm hoping it's just a bug.

Has anyone found any way to remove it otherwise?

like image 745
adamfootdev Avatar asked Aug 20 '19 15:08

adamfootdev


3 Answers

In swift you can do


extension UITextView {
    #if targetEnvironment(macCatalyst)
    @objc(_focusRingType)
    var focusRingType: UInt {
        return 1 //NSFocusRingTypeNone
    }
    #endif
}

like image 126
Amerino Avatar answered Nov 13 '22 02:11

Amerino


It helps to disable focus ring in all "view" classes in Catalyst

extension UIView {
    #if targetEnvironment(macCatalyst)
    @objc(_focusRingType)
    var focusRingType: UInt {
        return 1 //NSFocusRingTypeNone
    }
    #endif
}
like image 13
Dmitry Frantskevich Avatar answered Nov 13 '22 03:11

Dmitry Frantskevich


Please don't do this - this is a focus indicator for accessibility and is important for keyboard-only users.

like image 2
user11145365 Avatar answered Nov 13 '22 03:11

user11145365