SwiftUI TextField on macos hit `return` key won't resign responder, instead select all text?

Code Block Swift
private struct MyView: View {   
  @State var text: String = "textfield value."
   
  func onEditingChanged (isEditing: Bool) -> Void {
    print("changed \(isEditing)")
  }
   
  func onCommit() -> Void {
    print("commited")
    NSApplication.shared.sendAction(#selector(NSResponder.resignFirstResponder), to:nil, from:nil)
  }
   
  var body: some View {
    HStack {
      TextField("x", text: $text, onEditingChanged: onEditingChanged, onCommit: onCommit)
        .textFieldStyle(PlainTextFieldStyle())
        .disableAutocorrection(true)
    }
  }
}

After I finish entering on TextField and hit return key on my keyborad,I'm expecting the textfield to lose focus. However,it won't, and instead, all text in the textfield is selected? is there some workaround ?
I found a similar case here How can I remove Textfield focus when I press return or click outside Textfield? (SwiftUI, MacOS),with the following code
Code Block swift
   func onCommit() -> Void {
    DispatchQueue.main.async {
      NSApp.keyWindow?.makeFirstResponder(nil)
    }
  }

It's almost what I want, except that, after I press return key, I can see the selection flash and quickly disappear.
SwiftUI TextField on macos hit `return` key won't resign responder, instead select all text?
 
 
Q