toga icon indicating copy to clipboard operation
toga copied to clipboard

iOS dark mode: multiline input text is not visible

Open skrupenin opened this issue 1 year ago • 1 comments

Describe the bug

I'm building a chat application. Below is sub that generates main window.

On iPhone 7, SE, 15 in dark mode (physical devices) entered text is not visible: background is black and text color is black.

def create_conversation_ui(self):
    self.chat = toga.WebView(
        url=None,
        style=Pack(flex=1),
    )

    # Buttons
    self.text_input = toga.MultilineTextInput(
        style=Pack(flex=1, padding=5),
        placeholder='Type your',
        value = ''
    )
    self.send_button = toga.Button(
        "Send",
        on_press=self.handle_send_button,
        style=Pack(padding_top=5, padding_right=5),
    )
    share_feedback_button = toga.Button(
        "Share feedback",
        on_press=self.handle_share_feedback_button,
        style=Pack(padding_top=5, padding_right=5),
    )
    new_chat_button = toga.Button(
        "New chat",
        on_press=self.handle_new_chat_button,
        style=Pack(padding_top=5, padding_right=5),
    )

    buttons_box = toga.Box(
        children=[self.send_button,
                  share_feedback_button,
                  new_chat_button,
                  toga.Label('id: ' + device_id, style=Pack(color=GRAY))],
        style=Pack(direction=COLUMN),
    )

    input_box = toga.Box(
        children=[self.text_input, buttons_box],
        style=Pack(direction=ROW),
    )

    # Outermost box
    outer_box = toga.Box(
        children=[self.chat, input_box],
        style=Pack(direction=COLUMN),
    )

    return outer_box

Steps to reproduce

  1. Build interface and run on iPhone 7, SE, 15 in dark mode
  2. Go to 'Type your' multiline input text
  3. Type some text
  4. Text is not visible - issue

Expected behavior

Text is displayed in light color - white

Screenshots

IMG_9897 IMG_9899 Screenshot 2024-06-21 at 01 37 12

Environment

  • Operating System: iOS 17.5.1
  • Python version: 3.12
  • Software versions:
    • Briefcase: 0.3.19
    • Toga: 0.4.5

Logs

No response

Additional context

No response

skrupenin avatar Jun 20 '24 22:06 skrupenin

Thanks for the report. I've moved this to the Toga repository, because integration with dark mode isn't something that Briefcase controls - it's a Toga issue.

Unfortunately, I can't reproduce what you're describing. This might be because I can't work out what your example code is trying to do - it doesn't have a main window, and it references a "device ID", so it can't be used as is; and it contains a number of details that don't appear to have anything to do with a MultilineTextInput, so it's not clear if the issue is the interaction between widgets, or if it's with a single widget. It's also not clear how I'm meant to be interpreting the screenshots, because they seem to be substantially redacted, hiding all the useful details, in favour of large overlays of text repeating what the report is telling me.

If I create an app that only has a MultilineTextInput, it renders white text on black background when in dark mode. Toga isn't doing anything to alter the default colors, so I'm not sure how you'd be getting different behavior.

If you're able to provide a minimal reproduction case (i.e., a full app that only contains the code needed to reproduce the issue, I can take another look.

freakboy3742 avatar Jun 21 '24 05:06 freakboy3742

Cannot reproduce with just a single TextInput... will post code tomorrow.

johnzhou721 avatar May 07 '25 03:05 johnzhou721

Closing on the basis that it can't be reproduced; @johnzhou721 Feel free to post the code for posterity.

freakboy3742 avatar May 07 '25 23:05 freakboy3742

In beeware-tutorial/helloworld/src/helloworld/app.py, rest of files unchanged from BeeWare Tutorial (accepting all defaults on the step for cookiecutter):

import toga

def button_handler(widget):
    print("hello")


def build(app):
    box = toga.Box()

    inputbox = toga.TextInput(placeholder='Enter some text...')
    box.add(inputbox)

    return box


def main():
    return toga.App("First App", "org.beeware.toga.examples.tutorial.johnzhou721", startup=build)


if __name__ == "__main__":
    main().main_loop()

johnzhou721 avatar May 07 '25 23:05 johnzhou721

Hi! Should this be closed? The multiline input works per se but we're not sure about reporter's settings.

johnzhou721 avatar May 19 '25 03:05 johnzhou721