You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "qpwr (via GitHub)" <gi...@apache.org> on 2024/09/12 08:57:20 UTC

[I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

qpwr opened a new issue, #1491:
URL: https://github.com/apache/cordova-ios/issues/1491

   # Bug Report
   
   ## Problem
   
   ### What is expected to happen?
   
   If building for Mac Catalyst, the statusbar shouldn't overlay the web view.
   
   ### What does actually happen?
   
   The statusbar (which can't be disabled/hidden on macOS) overlays the web view and covers content which can't be reached through scrolling.
   
   ## Information
   
   The issue can be easily reproduced by using the HelloWorld example app and adding this right after the body tag in www/index.html:
   
   <div style="font-size:5rem;">EXAMPLE TEXT</div>
   
   After building the app **for Mac Catalyst** (not for Designed for iPad!), the view should look like this, the added text is cut off at the top:
   
   ![Bildschirmfoto 2024-09-12 um 10 50 39](https://github.com/user-attachments/assets/3baa40b3-07e5-41c0-a3eb-d8e4b7e64da6)
   
   More info:
   
   - The plugin cordova-plugin-statusbar doesn't help with the issue, I've tried all possible combinations
   - None of the following settings in xcode seem to make any difference:
      - Mac Catalyst Interface: Optimize for Mac vs. Scaled to match iPad
      - Status Bar Style
      - Hide during application launch (on vs. off)
      - Requires Full screen (on vs. off)
   
   ### Environment, Platform, Device
   
   - Macbook Pro 16'' 2023
   - macOS Sonoma 14.5
   
   ### Version information
   
   - cordova-ios 7.1.1
   
   ## Checklist
   
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "qpwr (via GitHub)" <gi...@apache.org>.
qpwr commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2346477126

   Thanks for replying!
   
   I couldn't imagine a case where you would want the statusbar to overlay the webview on macOS (meaning for Catalyst), because you can just resize the window. I could be wrong though.
   
   I tried your suggestions:
   
   - Using cordova-plugin-statusbar and setting `StatusBarOverlaysWebView` to `false` doesn't seem to make any difference
   - The webview does indeed respond to `env(safe-area-inset-top)` and adds a margin
   
   I personally would expect the statusbar to not be overlaying the webview by default or at least that you could control whether it does. Currently it does overlay the webview and it doesn't seem to be configurable.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2346202833

   I really don't know but couple more things to try that wasn't mentioned:
   
   - `StatusBarOverlaysWebView` preference (feature provided by the [cordova-plugin-statusbar](https://github.com/apache/cordova-plugin-statusbar?tab=readme-ov-file#configxml)). If the plugin is installed it also defaults to true so it could explain this behaviour. You can try setting it to false.
   - Does the webview respond to CSS safe area inset top?
   
   ```css
   body {
       margin-top: env(safe-area-inset-top, 0px);
   }
   ```
   
   Normal iOS behaviour is if the status bar is in overlay mode then CSS safe-area-inset-top is set accordingly so that you can use CSS to clear the statusbar for positioning your DOM nodes. If the statusbar is not in overlay mode, then the native webview starts just under the status bar, and the safe-area-inset-top will have a value of `0px` accordingly (unless if the device has some other screen gimmick)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "qpwr (via GitHub)" <gi...@apache.org>.
qpwr commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2346572997

   I'm not sure if I totally understand what you mean, but I have to add extra code for Catalyst now in order for this to work "as expected", as far as I understand it now.
   
   I am already using safe-area-insets to deal with special screens like the newer iPhones, but not to deal with the statusbar (which is generally hidden in my production app, using cordova-plugin-statusbar). If I now add new cases for safe-area-insets to deal with the statusbar issue on macCatalyst, this will collide with devices like newer iPhones.
   
   I would think this should be fixed in cordova-ios or cordova-plugin-statusbar, since right now the behavior differs from the iOS behavior (which allows to control the statusbar behavior through the plugin).
   
   I now created a simple plugin to detect whether we're on macCatalyst and will probably add an extra body class through this to attach some extra CSS to. But I would rather not. :-D
   
   https://github.com/qpwr/cordova-plugin-detect-mac-catalyst


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2346513811

   I understand where you're coming from. AFAIK the MacOS bar is never semi-transparent so it doesn't make sense for the webview to ever overlay underneath it.
   
   It does somewhat makes sense though if you think about the nuances of bringing iOS/iPadOS app to MacOS via catalyst because in iOS/iPadOS you usually do have a statusbar semi transparent and the webview is generally consumes that space for a seamless UI look, using safe-area-insets to push user content into safe area space.
   
   I'm not knowledged enough of the underlying Apple SDK to determine if this can be improved so I'll leave that to other committers to analyse if it is possible to make catalyst builds not have a webview that is hiding under the macOS bar, and whether that is something that should be implemented.
   
   It is good to know that it does respond to CSS safe area insets though, which is something that all applications should be using today. It is also possible that Apple is expecting apps to utilise the safe area insets so that your app will be more cross-platform compatible.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "dpogue (via GitHub)" <gi...@apache.org>.
dpogue closed issue #1491: The macOS statusbar overlays the web view on Mac Catalyst
URL: https://github.com/apache/cordova-ios/issues/1491


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "breautek (via GitHub)" <gi...@apache.org>.
breautek commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2360905826

   > Maybe this is something we can manage automatically based on the existence of viewport-fit=cover/viewport-fit=cover?
   
   I don't think this sounds right from an API standpoint. `viewport-fit` is suppose to simply change the viewport to scale and fit the "device screen" (which I guess for this would be the application window). Hiding the title based on this field would be an unrelated side effect and I think many would consider it to be a bug if implemented this way.
   
   I couldn't find any documentation on MDN but I found this on some sort of backup/experimental MDN site: https://udn.realityripple.com/docs/Web/CSS/@viewport/viewport-fit which states:
   
   > The viewport is scaled to fill the device display. It is highly recommended to make use of the [safe area inset variables](https://udn.realityripple.com/docs/Web/CSS/env) to ensure that important content doesn't end up outside the display.
   
   I guess a more authoritative source: https://www.w3.org/TR/css-round-display-1/#viewport-fit-descriptor
   
   > The initial layout viewport and the visual viewport are set to the circumscribed rectangle of the physical screen of the device.The initial layout viewport and the visual viewport are set to the circumscribed rectangle of the physical screen of the device.
   
   If we wanted to provide an API to hide/remove the title bar, it probably should be exposed independently of viewport-fit, in my opinion.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "dpogue (via GitHub)" <gi...@apache.org>.
dpogue commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2558292921

   I was hoping this would turn out to be an easy fix with a special case to turn off safe-area inset behaviour for Catalyst, but that is definitely not the case.
   
   If you turn off the safe-area-inset behaviour, then content always ends up behind the titlebar because Catalyst unconditionally sets the WebView to extend behind the titlebar: https://stackoverflow.com/questions/60728083/top-of-wkwebviewcontent-is-clipped-under-nstoolbar-in-mac-catalyst
   
   Rather than deal with using a bundle to hack around NSWindow internals, it seems like the best option is to use constraints to force the WKWebView to appear below the titlebar (which happens to be the safe area layout).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "dpogue (via GitHub)" <gi...@apache.org>.
dpogue commented on issue #1491:
URL: https://github.com/apache/cordova-ios/issues/1491#issuecomment-2359753719

   Note that it is possible (using platform code) to hide the titlebar on Catalyst apps, so it wouldn't be visibly covering the web view (but would instead not show a title): https://developer.apple.com/documentation/uikit/mac_catalyst/removing_the_title_bar_in_your_mac_app_built_with_mac_catalyst?language=objc
   
   Maybe this is something we can manage automatically based on the existence of `viewport-fit=cover`/`viewport-fit=cover`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Re: [I] The macOS statusbar overlays the web view on Mac Catalyst [cordova-ios]

Posted by "dpogue (via GitHub)" <gi...@apache.org>.
dpogue closed issue #1491: The macOS statusbar overlays the web view on Mac Catalyst
URL: https://github.com/apache/cordova-ios/issues/1491


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org