Skip to content
25 changes: 25 additions & 0 deletions src/ios/CDVWKInAppBrowser.m
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,11 @@ - (void)createViews

self.closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)];
self.closeButton.enabled = YES;

// Fixes the Liquid Glass issue on iOS version >= 26 where the buttons have a translucent background
if (@available(iOS 26.0, *)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe these checks are sufficient as it assumes that the environment is running at least XCode 26 and Cordova iOS framework declares support for XCode 15 and later.

There is a way to do a preprocessor check that is more resilient to the XCode environment, I just don't recall the exact syntax for that.

Copy link
Member

Choose a reason for hiding this comment

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

The preprocessor check might be this, but I don’t remember exactly.

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 260000
    if (@available(iOS 26.0, *)) {
        self.closeButton.hidesSharedBackground = YES;
    }
#endif

Copy link
Author

Choose a reason for hiding this comment

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

Thanks, i will add the preprocessor check too

self.closeButton.hidesSharedBackground = YES;
}

UIBarButtonItem* flexibleSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];

Expand All @@ -791,6 +796,11 @@ - (void)createViews
}
if (!_browserOptions.toolbartranslucent) { // Set toolbar translucent to no if user sets it in options
self.toolbar.translucent = NO;

// Fixes the Liquid Glass issue on iOS version >= 26 where the top bar becomes transparent
if (@available(iOS 26.0, *)) {
self.toolbar.backgroundColor = [self colorFromHexString:_browserOptions.toolbarcolor];
}
}

CGFloat labelInset = 5.0;
Expand Down Expand Up @@ -833,6 +843,11 @@ - (void)createViews
self.forwardButton.tintColor = [self colorFromHexString:_browserOptions.navigationbuttoncolor];
}

// Fixes the Liquid Glass issue on iOS version >= 26 where the buttons have a translucent background
if (@available(iOS 26.0, *)) {
self.forwardButton.hidesSharedBackground = YES;
}

NSString* backArrowString = NSLocalizedString(@"◄", nil); // create arrow from Unicode char
self.backButton = [[UIBarButtonItem alloc] initWithTitle:backArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
self.backButton.enabled = YES;
Expand All @@ -841,6 +856,11 @@ - (void)createViews
self.backButton.tintColor = [self colorFromHexString:_browserOptions.navigationbuttoncolor];
}

// Fixes the Liquid Glass issue on iOS version >= 26 where the buttons have a translucent background
if (@available(iOS 26.0, *)) {
self.backButton.hidesSharedBackground = YES;
}

// Filter out Navigation Buttons if user requests so
if (_browserOptions.hidenavigationbuttons) {
if (_browserOptions.lefttoright) {
Expand Down Expand Up @@ -881,6 +901,11 @@ - (void)setCloseButtonTitle:(NSString*)title : (NSString*) colorString : (int) b
// If color on closebutton is requested then initialize with that that color, otherwise use initialize with default
self.closeButton.tintColor = colorString != nil ? [self colorFromHexString:colorString] : [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1];

// Fixes the Liquid Glass issue on iOS version >= 26 where the buttons have a translucent background
if (@available(iOS 26.0, *)) {
self.closeButton.hidesSharedBackground = YES;
}

NSMutableArray* items = [self.toolbar.items mutableCopy];
[items replaceObjectAtIndex:buttonIndex withObject:self.closeButton];
[self.toolbar setItems:items];
Expand Down
Loading