Work on general layout improvements. Making special cases for Safari browsers.

This commit is contained in:
Scott Idem
2025-06-26 20:41:25 -04:00
parent 4ef2e7cd6b
commit bd0d96cb83
3 changed files with 17 additions and 7 deletions

View File

@@ -65,6 +65,7 @@ const ae_app_local_data_defaults: key_val = {
theme_mode: 'light',
theme_name: 'nouveau', // wintry
iframe: false,
browser_type: null, // Safari needs help with scrolling correctly in iframes.
title: `OSIT's Æ`, // - Dev SvelteKit`, // Æ
debug_menu: false, // Flag show debug menu.

View File

@@ -173,6 +173,11 @@ function add_activity_log(
let message = {'event_id': idaa_event_obj?.event_id};
window.parent.postMessage(message, "*");
if ($ae_loc?.iframe && $ae_loc.browser_type == 'safari') {
console.log('In Safari iframe, sending message to parent window to scroll to top as well');
window.parent.postMessage({'scroll_to': 0}, "*"); // This should be in pixels
}
// $idaa_sess.recovery_meetings.show_main__options = true;
// $idaa_sess.recovery_meetings.show_list__event_obj_li = true;
$idaa_trig.event_id = true;

View File

@@ -172,11 +172,11 @@ $effect(() => {
// console.log(`idaa_root_layout.svelte: data:`, data);
// }
// // If the browser is Safari, we need to handle the scroll differently
// if (is_safari) {
// console.log('Safari detected, using special scroll handling');
// // Add any Safari-specific logic here if needed
// }
// If the browser is Safari, we need to handle the scroll differently
if (is_safari) {
console.log('Safari detected, using special scroll handling');
$ae_loc.browser_type = 'safari';
}
// // Initial scroll position
// scroll_y = scroll_container().scrollTop;
@@ -373,10 +373,14 @@ $effect(() => {
}
// var is_safari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
if (is_safari) {
console.log('Safari detected, not using smooth scroll to top');
console.log('Safari detected, not using smooth scroll to top.');
document.getElementById('ae_idaa')?.scrollTo(0, 0);
window.parent.postMessage({'scroll_to': 0}, "*"); // This should be in pixels
if ($ae_loc?.iframe) {
// If in iframe, we need to send a message to the parent window to scroll to top
console.log('In Safari iframe, sending message to parent window to scroll to top as well');
window.parent.postMessage({'scroll_to': 0}, "*"); // This should be in pixels
}
} else {
console.log('Not Safari, using smooth scroll to top');
document.getElementById('ae_idaa')?.scrollTo({