RFR: 8374329: PasswordField ignores custom accessible text
Christopher Schnick
duke at openjdk.org
Wed Dec 24 16:58:26 UTC 2025
On Wed, 24 Dec 2025 16:06:56 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> This is a pretty simple fix for the accessible text of password fields.
>
> 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
> 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
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2020#discussion_r2646050962
PR Review Comment: https://git.openjdk.org/jfx/pull/2020#discussion_r2646049436
More information about the openjfx-dev
mailing list