System Version: macOS Monterey 12.3.1
My app has a button which will show popover when clicked the button and make a button in the popover to be the popover's window's firstResponder. When Voiceover is not on, I am able to close the popover using escape key (handled by NSpopover's contentView). But when I turned voice over on, pressing escape key cause both the popover and its parent window to escape, and the debug result showed that the popover's sender received the key event rather the popover (In sender's window pressing escape will close the window).
This problem disappeared when I changed the popover's behavior to .applicationDefined (still not working for .transient or .semitransient), but I still want to know why VoiceOver will affect the behavior of NSpopover
Post
Replies
Boosts
Views
Activity
My app has an NSpopover and its contentView's hierarchy is as follow, but when voice over is on, it will only announce "You are on a cell".
I want VoiceOVer read keyboard navigation hints ( like this picture).:
Logs are added for entering or leaving method like this
class MyWindow: NSWindow {
...
override open func makeKeyAndOrderFront(_ sender: Any?) {
debugPrint("will front\(Float(clock())/Float(CLOCKS_PER_SEC))")
super.makeKeyAndOrderFront(sender)
debugPrint("fronted\(Float(clock())/Float(CLOCKS_PER_SEC))")
}
...
override open func deminiaturize(_ sender: Any?) {
debugPrint("will front\(Float(clock())/Float(CLOCKS_PER_SEC))")
deminiaturize(sender)
debugPrint("fronted\(Float(clock())/Float(CLOCKS_PER_SEC))")
}
}
when I calls deminiaturize(_:) on macOS 12, the log printed like this every time
will deminiaturize42.011353"
will front42.012936"
fronted42.015907"
deminiaturized42.01639"
but on macOS 13, the log printed like this
will deminiaturize37.431595"
deminiaturized37.431637"
will front37.491123"
fronted37.491623"
seems that on macos13, the deminiaturize(:) no longer calls makeKeyAndOrderFront(:) synchronously. Is this a bug?
import Cocoa
class ViewController: NSViewController {
@IBOutlet var button: NSButton!
override func viewDidLoad() {
super.viewDidLoad()
button.keyEquivalent = "m"
button.keyEquivalentModifierMask = [.control]
// Do any additional setup after loading the view.
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
@IBAction func buttonclicked(_ sender: NSButton) {
debugPrint("cliked")
}
}
but the debug shows that keyEquivalentModifierMask was not set properly
button.keyEquivalentModifierMask NSEvent.ModifierFlags [.command]
//
// AppDelegate.swift
// HelloCocoa
//
import Cocoa
@main
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
let myAlert = NSAlert()
myAlert.messageText = "Alert Title"
let messageAttributedString = NSAttributedString(string: "Hello,world", attributes: [.font : NSFont.systemFont(ofSize: 12, weight: .bold)])
let myTextField = NSTextField(labelWithAttributedString: messageAttributedString)
myTextField.allowsEditingTextAttributes = true
myTextField.isSelectable = true
myAlert.accessoryView = myTextField
myAlert.runModal()
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}
}
The alert appears like this:
but when I clicks on the textfield, the text's color become black:
Adding foregroundColor key to attribute dictionary works for me but I really want to know why NSTextfield has such behavior
I want to do something when user has no speaker devices in my program, but I found that all Mac devices available recent years have built in speakers, and I can‘t disable it. I have tried many methods like kill audio services and unload kexts but failed. How can I make internal speaker not enumerated in the device list?
macOS 13.5 Beta (22G5038d)
Xcode Version 14.2 (14C18)
Sample project: https://developer.apple.com/tutorials/mac-catalyst/turning-on-mac-catalyst
The app may become unresponsive when dragging the right edge of the window quickly. The stack trace is pasted below.
Apple has introduced a way to disable Reactions by default with the key NSCameraReactionEffectGesturesEnabledDefault. I have checked and unchecked the reactions for several times, how to simulate the default behaviour scenario? Is there any setting or command line utility to reset my Mac mini to the default state for reactions gesture?