My app is developed using Cordova/Ionic, Angular 14. While everything works perfectly on Chrome and iOS, I am encountering issues with the Android webview not supporting the CSS inset
property. This causes problems as Angular converts top: 0; ...
to inset: ...
. I have tried but failed to resolve this.
The following css is found in a xy.component.scss file:
::ng-deep sc-modal-wizard-page > div:not(.defines-height) {
position: absolute;
top: 0px !important;
bottom: 0px !important;
left: 0px !important;
right: 0px !important;
overflow: auto;
}
Angular compiles it to:
sc-modal-wizard-page>div:not(.defines-height){position:absolute;inset:0;overflow:auto}
However, when running the app on Android (emulator or physical device), the positioning does not work. WebView debugging indicates that inset:0
is rejected as an 'invalid css value'.
https://i.sstatic.net/Ak9Ux.png
Manually adding the values for left, top, bottom, right
through DevTools solves the problem temporarily.
Android System WebView version is 83.0.4103.106. Considering that chromium version 83 doesn't support inset and Chrome started supporting it from version 87, this behavior makes sense.
I've been attempting to make Angular compile correctly by adding a .browserslistsrc file and the necessary package (npm i browserslist). I configured the file for compatibility with all versions of Chrome:
# This file helps autoprefixer adjust CSS to support specified browsers
Chrome >= 0
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
# IE 9-11
Despite this, the output still includes the inset property. How can I get Angular to compile the application while considering the browser capabilities specified?