RFR: 8374329: PasswordField ignores custom accessible text
Andy Goryachev
angorya at openjdk.org
Wed Dec 24 17:11:07 UTC 2025
On Wed, 24 Dec 2025 16:55:04 GMT, Christopher Schnick <duke at openjdk.org> wrote:
>> modules/javafx.controls/src/main/java/javafx/scene/control/PasswordField.java line 85:
>>
>>> 83: case TEXT:
>>> 84: String accText = getAccessibleText();
>>> 85: if (accText != null && !accText.isEmpty()) return accText;
>>
>> minor: please add { }'s
>
> I used TextInputControl as a reference, which uses the same style. I thought it would be better to stay close to the original function that is overriden. I can change it if you still want that
yes, I realized that. It's up to you, but I do prefer to have one statement per line, and always use { }. It is easier to step through in the debugger, and also the line numbers in logs and exception stack traces are more informative this way, and the { } are because I've seen too many cases of
if(condition)
do_one();
do_two();
in the past.
>> modules/javafx.controls/src/main/java/javafx/scene/control/PasswordField.java line 86:
>>
>>> 84: String accText = getAccessibleText();
>>> 85: if (accText != null && !accText.isEmpty()) return accText;
>>> 86: return getPromptText();
>>
>> `getPromptText()` returns "" when `promptText` property is not set, resulting in this method returning "". Shouldn't it return `null` instead?
>
> I looked into other implementations of this method and they kinda mixed the usage of "" and null. From that I would expect that the end result for the screen reader would be the same. TextInputControl does it the same way
this question is for @azuev-java mostly. We have several platforms and several screen readers for each, I don't know whether they all treat "" consistently.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2020#discussion_r2646062600
PR Review Comment: https://git.openjdk.org/jfx/pull/2020#discussion_r2646065499
More information about the openjfx-dev
mailing list