Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Password manager: Fix tabbing between text fields #3724

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// AutoRecalculatingKeyViewHostingView.swift
//
// Copyright © 2025 DuckDuckGo. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

import SwiftUI

final class AutoRecalculatingKeyViewHostingView<Content: View>: NSHostingView<Content> {
override func layout() {
super.layout()

// Fix not being able to tab between TextFields by manually updating key view loop after SwiftUI has finished layout. This doesn't happen automatically because MainWindow sets autorecalculatesKeyViewLoop to false.
self.window?.recalculateKeyViewLoop()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ final class PasswordManagementViewController: NSViewController {

self.itemModel = itemModel

let view = NSHostingView(rootView: PasswordManagementLoginItemView().environmentObject(itemModel))
let view = AutoRecalculatingKeyViewHostingView(rootView: PasswordManagementLoginItemView().environmentObject(itemModel))
replaceItemContainerChildView(with: view)
}

Expand All @@ -478,7 +478,7 @@ final class PasswordManagementViewController: NSViewController {

self.itemModel = itemModel

let view = NSHostingView(rootView: PasswordManagementIdentityItemView().environmentObject(itemModel))
let view = AutoRecalculatingKeyViewHostingView(rootView: PasswordManagementIdentityItemView().environmentObject(itemModel))
replaceItemContainerChildView(with: view)
}

Expand All @@ -494,7 +494,7 @@ final class PasswordManagementViewController: NSViewController {

self.itemModel = itemModel

let view = NSHostingView(rootView: PasswordManagementNoteItemView().environmentObject(itemModel))
let view = AutoRecalculatingKeyViewHostingView(rootView: PasswordManagementNoteItemView().environmentObject(itemModel))
replaceItemContainerChildView(with: view)
}

Expand All @@ -510,7 +510,7 @@ final class PasswordManagementViewController: NSViewController {

self.itemModel = itemModel

let view = NSHostingView(rootView: PasswordManagementCreditCardItemView().environmentObject(itemModel))
let view = AutoRecalculatingKeyViewHostingView(rootView: PasswordManagementCreditCardItemView().environmentObject(itemModel))
replaceItemContainerChildView(with: view)
}

Expand Down
Loading