Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog windows are not modal #2446

Closed
LordOfDragons opened this issue Mar 8, 2024 · 3 comments · Fixed by #2582
Closed

Dialog windows are not modal #2446

LordOfDragons opened this issue Mar 8, 2024 · 3 comments · Fixed by #2582
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support.

Comments

@LordOfDragons
Copy link

Describe the bug

Create a dialog like this:

async def on_button_test(widget):
    await self.main_window.info_dialog(title="Dialog", message="An Info Dialog")

You can now click on the main window behind the dialog and the main window is activated although the dialog is still floating above the window. This allows the dialog to be shown again or other actions to be triggered although the user should be blocked in the dialog.

Either change the behavior of dialogs to be modal or add a "modal={True|False}" property to "info_dialog" (and all similar functions) to enforce this.

Steps to reproduce

  1. Create self.main_window.info_dialog
  2. Click main window
  3. Main window is activated and can be interacted with.

Expected behavior

Main window can not be activated (dialog keeps focus)

Screenshots

No response

Environment

Linux (GenToo). Toga in virtual environment.

Logs

No response

Additional context

No response

@LordOfDragons LordOfDragons added the bug A crash or error in behavior. label Mar 8, 2024
@freakboy3742
Copy link
Member

Thanks for the report. Looks like this might have been an oversight when we modified the dialog implementation to make it testable.

It looks like adding self.native.set_modal(True) around L33 of gtk/src/toga_gtk/dialogs.py will make the dialog modal without breaking the testability of the dialog. There might be a similar change needed for the non-message dialogs (e.g. stack trace and file selection dialogs).

@freakboy3742 freakboy3742 added good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support. labels Mar 8, 2024
@LordOfDragons
Copy link
Author

I also just noticed the close button in the default About dialog has no effect (aka not closing the dialog).

@freakboy3742
Copy link
Member

I've noticed that as well, but not logged it. I've fixed that problem as part of #2244 - the specific change is this one - however, that PR is taking a lot longer to land than originally planned. If that change were to slip into a fix for this issue, that would probably be for the better.

jepler added a commit to jepler/toga that referenced this issue May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. good first issue Is this your first time contributing? This could be a good place to start! linux The issue relates Linux support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants