From 4c744e6d1096681ae89045961d15eb2eb3600e3b Mon Sep 17 00:00:00 2001 From: Ilyas Hallak Date: Fri, 10 Oct 2025 20:18:38 +0200 Subject: [PATCH] fix: Add comprehensive width constraints to NativeWebView CSS Added multiple CSS rules to prevent content overflow: Universal rules: - * { max-width: 100%; box-sizing: border-box; } HTML/Body: - overflow-x: hidden on both html and body - width: 100% to enforce viewport width - word-wrap and overflow-wrap: break-word on body Pre blocks: - max-width: 100% - white-space: pre-wrap (allows wrapping) - word-wrap: break-word Viewport meta: - Added maximum-scale=1.0, user-scalable=no to prevent zooming issues The native iOS 26+ WebView handles width differently than WKWebView, requiring explicit overflow and width constraints in CSS. --- .../BookmarkDetailLegacyView.swift | 1 + .../BookmarkDetail/BookmarkDetailView2.swift | 6 +----- readeck/UI/Components/NativeWebView.swift | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/readeck/UI/BookmarkDetail/BookmarkDetailLegacyView.swift b/readeck/UI/BookmarkDetail/BookmarkDetailLegacyView.swift index f3a4973..bd03913 100644 --- a/readeck/UI/BookmarkDetail/BookmarkDetailLegacyView.swift +++ b/readeck/UI/BookmarkDetail/BookmarkDetailLegacyView.swift @@ -115,6 +115,7 @@ struct BookmarkDetailLegacyView: View { } } .coordinateSpace(name: "scrollView") + .clipped() .ignoresSafeArea(edges: .top) .scrollPosition($scrollPosition) .onPreferenceChange(ScrollOffsetPreferenceKey.self) { offset in diff --git a/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift b/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift index 09252a1..44222fe 100644 --- a/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift +++ b/readeck/UI/BookmarkDetail/BookmarkDetailView2.swift @@ -46,6 +46,7 @@ struct BookmarkDetailView2: View { // Main scroll content scrollViewContent } + .navigationBarTitleDisplayMode(.inline) .toolbar { toolbarContent @@ -100,20 +101,15 @@ struct BookmarkDetailView2: View { VStack(spacing: 0) { ZStack(alignment: .top) { - // Header image (in background) headerView - // Content (in foreground) VStack(alignment: .leading, spacing: 16) { - // Spacer for header Color.clear.frame(width: geometry.size.width, height: viewModel.bookmarkDetail.imageUrl.isEmpty ? 84 : headerHeight) - // Title section titleSection Divider().padding(.horizontal) - // Jump to last position button if showJumpToProgressButton { jumpButton(containerHeight: geometry.size.height) } diff --git a/readeck/UI/Components/NativeWebView.swift b/readeck/UI/Components/NativeWebView.swift index 0322ff6..507d3b9 100644 --- a/readeck/UI/Components/NativeWebView.swift +++ b/readeck/UI/Components/NativeWebView.swift @@ -108,9 +108,19 @@ struct NativeWebView: View { let styledHTML = """ - +