beeware/toga

WebView on Android displays empty page when html contains style element

クローズ

#2,242 opened on 2023/11/24

 (14 件のコメント) (0 件のリアクション) (0 人の担当者)Python (624 件のフォーク)batch import
androidbuggood first issue

Repository metrics

Stars
 (3,615 個のスター)
PR merge metrics
 (平均マージ 5d) (30d で 64 merged PRs)

説明

Describe the bug

When displaying a html file that contains a style element (on Android) the page is not rendered and remains white. The html file is rendered correctly with Android's HTML Viewer The html file is rendered correctly in WebView on Windows The html file was rendered correctly in WebView on Android with Toga 0.3.1dev93

When the style element is removed, the page is shown in WebView (but without the styles of course). When using a separate CSS file, the html file is shwon in WebView but without the styles.

Steps to reproduce

I use this code to display the html file:

        # create box for content
        main_box = toga.Box(style=Pack(direction=COLUMN, flex=1))
        # read help file
        f = open(self._html_file, "r", encoding="utf-8")
        text = f.read()
        f.close()
        webView = toga.WebView(style=Pack(flex=1))
        webView.set_content("data:text/html", text)
        main_box.add(webView)

Expected behavior

The html file should be rendered correctly also with Toga 0.4.x

Screenshots

No response

Environment

  • Operating System: Android 13
  • Python version: 3.11.2
  • Software versions:
    • Briefcase: 0.3.16
    • Toga: 0.4.1.dev65+g0eaf2c06e

help-en.html.zip

Logs

Additional context

No response

コントリビューターガイド