Comments (7)
Thank you for the reply @walaszczykm!
The issue templates didn't pop-up when opening a new issue so I assumed there were none, sorry 😅
I had a look at the source and I couldn't find any code related to CSS variables either which was pretty strange. It could have something to do with the chat being rendered in an iframe, and the html
within it overriding the CSS variables of the containing html
tag?
No idea. I'll create a reproduction as soon as I have time!
from chat-widget-adapters.
Hello @creativiii 👋
Thanks for the report. Sad to hear you have encountered an issue with the library.
For the future, please use dedicated Issue templates as they provide questions for all necessary information we need for problem investigation. Also, they automatically assign our team, which notifies us about reports much quicker 🙂
In the case of safe-area-inset-top
nowhere in our code, we are setting this value explicitly, nor we are affecting the host CSS variables. I wonder if the issue is not related to the native webview behavior itself, changing the safe-area-inset-top
to 0
for maximized absolute content of Chat Widget. At the moment your workaround looks very solid. We will take a look if we can do something about it in a more pleasant way for you as an Application Developer 🙂
from chat-widget-adapters.
For ionic / Angular / CapacitorJs:
in html add Events:
<livechat-widget license="123456789" visibility="minimized" (onVisibilityChanged)="visiChange($event)"></livechat-widget>
in ts:
visiChange(event: EventHandlerPayload<'onVisibilityChanged'>) {
if (Capacitor.getPlatform() == 'ios') {
if (event.visibility == 'minimized') {
let a = document.getElementById('chat-widget-container') as HTMLElement;
setTimeout(() => {
let b = a.firstChild as HTMLElement;
b.style.margin = "0";
}, 500)
}else{
let a = document.getElementById('chat-widget-container') as HTMLElement;
setTimeout(() => {
let b = a.firstChild as HTMLElement;
b.style.margin = "56px 0"
}, 500)
}
}
}
from chat-widget-adapters.
The issue comes directly from the native web view behavior, and we are not going to implement any web view-specific CSS style fixes atm. The proposed workaround #40 (comment) looks solid and can be easily used while embedding the Chat Widget into a native webview.
from chat-widget-adapters.
I don't know if anyone will ever see this but my workaround ended up being this:
Save CSS variables in a local ref:
const safeAreaRef = useRef({
top: getComputedStyle(document.documentElement).getPropertyValue(
'--ion-safe-area-top'
),
bottom: getComputedStyle(document.documentElement).getPropertyValue(
'--ion-safe-area-bottom'
),
});
Then inject them into the CSS with something like emotion
:
import { css, Global } from '@emotion/react';
// ...
<Global
styles={css`
#chat-widget-container iframe {
padding-top: ${safeAreaRef.current.top} !important;
padding-bottom: ${safeAreaRef.current.bottom} !important;
}
`}
/>
from chat-widget-adapters.
For ionic / Angular / CapacitorJs:
in html add Events:
<livechat-widget license="123456789" visibility="minimized" (onVisibilityChanged)="visiChange($event)"></livechat-widget>
in ts:
visiChange(event: EventHandlerPayload<'onVisibilityChanged'>) { if (Capacitor.getPlatform() == 'ios') { if (event.visibility == 'minimized') { let a = document.getElementById('chat-widget-container') as HTMLElement; setTimeout(() => { let b = a.firstChild as HTMLElement; b.style.margin = "0"; }, 500) }else{ let a = document.getElementById('chat-widget-container') as HTMLElement; setTimeout(() => { let b = a.firstChild as HTMLElement; b.style.margin = "56px 0" }, 500) } } }
Careful with setting hardcoded margins, not all iPhone screens have notches, and the ones that don't are quite small!
from chat-widget-adapters.
For ionic / Angular / CapacitorJs:
in html add Events:
<livechat-widget license="123456789" visibility="minimized" (onVisibilityChanged)="visiChange($event)"></livechat-widget>
in ts:visiChange(event: EventHandlerPayload<'onVisibilityChanged'>) { if (Capacitor.getPlatform() == 'ios') { if (event.visibility == 'minimized') { let a = document.getElementById('chat-widget-container') as HTMLElement; setTimeout(() => { let b = a.firstChild as HTMLElement; b.style.margin = "0"; }, 500) }else{ let a = document.getElementById('chat-widget-container') as HTMLElement; setTimeout(() => { let b = a.firstChild as HTMLElement; b.style.margin = "56px 0" }, 500) } } }
Careful with setting hardcoded margins, not all iPhone screens have notches, and the ones that don't are quite small!
Yes i know. But my Targeted Devices are new. and i think all new devices have notches. But thanks for the tip.
from chat-widget-adapters.
Related Issues (20)
- Color Change on react js HOT 1
- Question: How to use with Custom Identity Provider? HOT 2
- Set LiveChat Customer Avatar HOT 1
- Angular v15 update HOT 4
- Angular v15 update HOT 2
- Add SvelteKit Support HOT 1
- Intermittent white bar on bottom on mobile devices HOT 1
- Angular Adaptor Event Handlers
- uniapp require is not defined.
- hook to open the chat from a button or event
- Update window types
- Support Angular 16 HOT 1
- Programmatically start chat HOT 2
- asyncInit incorportation
- visibility="minimized" do hide chat icon in mobile view. HOT 1
- Cannot read properties of null (reading 'useRef')
- Hooks for interacting with the widget
- How to get baseAPI when use customIdentityProvider
- Minimised hides the vue chat widget, if the support is offline. HOT 1
- Update library to support Angular v18 compatibility HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chat-widget-adapters.