On Thu, 5 Mar 2026 18:02:50 GMT, Dmitry Markov <[email protected]> wrote:

> In `MacCommonDialogs__showFileSaveChooser`, we pre-populate the Save dialog 
> name field using: `setNameFieldStringValue`.
> After that `DialogDispatcher applyExtensions(...)` is invoked. 
> applyExtensions builds the extension filters, selects the default filter and 
> immediately calls `extensionFilterChanged`. That callback reconfigures the 
> `NSSavePanel` allowed types for the selected filter. If the initial filename 
> already contains an extension (e.g. _file.rich_) and the selected filter also 
> enforces that extension (_rich_), the panel effectively appends the extension 
> again resulting in the UI showing _file.rich.rich_. This is especially 
> visible for non-standard extensions like ._rich_.The ._txt_ often appears 
> “normal” because macOS handles known extensions and “hide extension” 
> presentation.
> 
> Fix:
> Always pre-fill the name field with a base name only (no extension) and let 
> the panel/filter selection supply the extension

> with the new monkey tester, the behavior appears incorrect.
> 
> to reproduce:
> 
> * initial file name = "aa.txt"
> * select all extensions under Extension filter
> * selected filter: *.txt
> * press [Show Save] button
> 
> the dialog appears with "aa" file name (instead of aa.txt with "aa" portion 
> selected as before). click Save and the stdout shows "aa" filename instead of 
> "aa.txt"
> 
> I could be doing something wrong with the original reproducer code, or in the 
> monkey tester.
> 
> Note: same scenario in the master shows the dialog I've never seen before:
> 
> <img alt="Image" width="732" height="530" 
> src="https://private-user-images.githubusercontent.com/107069028/559012849-889f7d7a-06b8-473a-b6b1-ed6316df6532.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzI5ODk4NjYsIm5iZiI6MTc3Mjk4OTU2NiwicGF0aCI6Ii8xMDcwNjkwMjgvNTU5MDEyODQ5LTg4OWY3ZDdhLTA2YjgtNDczYS1iNmIxLWVkNjMxNmRmNjUzMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwMzA4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MDMwOFQxNzA2MDZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mYmE1ZmUwN2U4NWU2NjNkNjMyYTU4OGQ0YmFhNjNhZDIwZDFjYTUyNThjYzgyOWU2OGJhMGI0ODQzMjE2Y2ZiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.-20mTZB2c0-Z6HFULD5njIXZ9Bo85XHaLZWP85uqO-w";>

There is an issue in TestMonkey: the FileChooser.ExtensionFilter patterns are 
missing the * wildcard when specifying file extensions (see lines 
[59–61](https://github.com/andy-goryachev-oracle/MonkeyTest/blob/988c16e00e1d89448470978155166ff1adfe2d83/src/com/oracle/tools/fx/monkey/pages/FileChooserPage.java#L59)).

Proposed change:


    private static final FileChooser.ExtensionFilter EF_JPG = new 
FileChooser.ExtensionFilter("*.jpg", "*.jpg", "*.jpeg");
    private static final FileChooser.ExtensionFilter EF_TXT = new 
FileChooser.ExtensionFilter("*.txt", "*.txt");
    private static final FileChooser.ExtensionFilter EF_UNK = new 
FileChooser.ExtensionFilter("*.unk", "*.unk");

After applying the above change FileChooser in TestMonkey works as expected

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2096#issuecomment-4019583950
PR Comment: https://git.openjdk.org/jfx/pull/2096#issuecomment-4019588008

Reply via email to