Skip to content
Merged
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
Expand Up @@ -299,7 +299,11 @@ private void deserializeConfig(@Nullable Context context) {
loggingEnabled = isDebug;
}

initialFocus = JSONUtils.getBoolean(configJSON, "android.initialFocus", initialFocus);
initialFocus = JSONUtils.getBoolean(
configJSON,
"android.initialFocus",
JSONUtils.getBoolean(configJSON, "initialFocus", initialFocus)
);

// Plugins
pluginsConfiguration = deserializePluginsConfig(JSONUtils.getObject(configJSON, "plugins"));
Expand Down
12 changes: 12 additions & 0 deletions cli/src/declarations.ts
Copy link
Member

@jcesarmobile jcesarmobile Nov 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The android/ios initialFocus texts should include a new line that says something like

Overrides global initialFocus option.

As we do in other options that have global and platform specific configuration

Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ export interface CapacitorConfig {
*/
zoomEnabled?: boolean;

/**
* Whether to give the webview initial focus.
*
* @since 7.0.0
* @default true
*/
initialFocus?: boolean;

android?: {
/**
* Specify a custom path to the native Android project.
Expand Down Expand Up @@ -191,6 +199,8 @@ export interface CapacitorConfig {
/**
* Whether to give the webview initial focus.
*
* Overrides global `initialFocus` option.
*
* @since 3.5.1
* @default true
*/
Expand Down Expand Up @@ -453,6 +463,8 @@ export interface CapacitorConfig {
/**
* Whether to give the webview initial focus.
*
* Overrides global `initialFocus` option.
*
* @since 7.0.0
* @default true
*/
Expand Down
2 changes: 1 addition & 1 deletion ios/Capacitor/Capacitor/CAPInstanceDescriptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ internal extension InstanceDescriptor {
isWebDebuggable = true
#endif
}
if let initialFocus = config[keyPath: "ios.initialFocus"] as? Bool {
if let initialFocus = (config[keyPath: "ios.initialFocus"] as? Bool) ?? (config[keyPath: "initialFocus"] as? Bool) {
hasInitialFocus = initialFocus
}
}
Expand Down
Loading