Skip to content

Dialogs and message boxes inherit the owner window styling (white-flash / photosensitivity fix)#1

Open
douglas-carmichael wants to merge 1 commit into
git-moss:mainfrom
douglas-carmichael:inherit-owner-styling-for-dialogs
Open

Dialogs and message boxes inherit the owner window styling (white-flash / photosensitivity fix)#1
douglas-carmichael wants to merge 1 commit into
git-moss:mainfrom
douglas-carmichael:inherit-owner-styling-for-dialogs

Conversation

@douglas-carmichael

Copy link
Copy Markdown

Companion to git-moss/ConvertWithMoss#199, which fixes the same problem for the two dialogs ConvertWithMoss creates itself. The message boxes created inside uitools (Functions.message / error / yesOrNo / choose / inputText / progress dialog) have the same two issues and can only be fixed here:

  1. They are rendered with the platform default styling, so with a dark application theme they appear as bright light-themed windows.
  2. Their scenes keep the default white fill, which is rendered until the first pulse paints the content - every dialog opens with a bright white flash. Against a dark UI this is a genuine accessibility risk for photo-sensitive users (epilepsy, migraine), and it fires on every message box.

Changes:

  • New public helper Functions.inheritStyling (Dialog<?>, Window): copies the stylesheets and the scene fill color of the owner window to the dialog scene (null-safe for owner-less dialogs).
  • Applied at every Alert/TextInputDialog creation site in Functions.
  • AbstractDialog applies it in the constructor and re-applies it on every show (via showingProperty), since the application theme might have been switched while a persistent dialog (e.g. a settings dialog) was hidden.

Since a dialog simply inherits whatever the owner scene carries, this is theme-agnostic: applications without custom styling see no change (they inherit an empty stylesheet list and the default white fill).

Note: this repository is at version 2.0.1 while ConvertWithMoss 19.0.0 ships uitools 2.0.5, so this branch may need porting to your current development line - happy to adapt it if you can push the newer source.

Verified: compiles against JDK 25; the logic mirrors the app-side fix in ConvertWithMoss#199. If you cut a uitools release with this, the explicit dialog styling in ConvertWithMoss#199 becomes redundant (but harmless).

All dialogs (AbstractDialog subclasses, the Alert based message/error/
confirmation boxes and the text input dialog) were rendered with the
platform default styling: with a dark application theme they appeared
in the light theme and always with a bright white flash while the
window was rendered for the first time - a real risk for
photo-sensitive users.

The new public helper Functions.inheritStyling copies the stylesheets
and the scene fill color of the owner window to the dialog scene. It is
applied at every dialog creation site and AbstractDialog re-applies it
on every show since the application theme might have changed in the
meantime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant