.searchble Keyboard Incorrectly Showing After Presenting Popup

I have a list view that is accessed by pressing a button from a pervious view, all are which are in a NavigationView from the Main view. For this list view I have applied the .searchable tag to allow users to search through the list. When a user taps on an item in the list a .sheet will present to present a more detailed overview.

The issue happens that if a user searches for an item in the list, and taps on the item to present the sheet the keyboard will disappear while the sheet presents but then pop back up despite still editing the search bar on the list view.

Currently, my view is roughly set up like this.

var body: some View {
ThemesListView
}
.sheet(item: $presentedSheetTheme, onDismiss: { fetchedThemes.nsSortDescriptors = themeListSort.nsSortDescriptorObject }) {themeToPassOn in 
EditThemeView(themeToEdit: themeToPassOn) }


var ThemesListView: some View {
List {
Button(action: {
                        presentedSheetTheme = theme
}
}
.searchable(text: query, placement: .navigationBarDrawer(displayMode: .always))
}

I have tried many things to fix this, even finding this thread (https://forums.developer.apple.com/forums/thread/746826) however none of the solutions were any help.

Here is a link (https://imgur.com/a/KKJ27iY) to a video of the issue.

This issue seems to be fixed in some iOS versions such as 17.0 and 18.0 Beta 1 however many other versions such as 17.4 or 17.5 still experience this issue meaning I still need to fix it for these versions.

Any help would be greatly appreciated, thanks!

.searchble Keyboard Incorrectly Showing After Presenting Popup
 
 
Q