RFR: 8178368: Right and Center alignment of text field works incorrectly
John Hendrikx
jhendrikx at openjdk.org
Fri Feb 10 10:55:52 UTC 2023
On Thu, 22 Dec 2022 10:33:15 GMT, Ajit Ghaisas <aghaisas at openjdk.org> wrote:
> The proposed fix fixes the reported issue.
>
> **Regarding the question of changing current behavior of RIGHT alignment of the TextField:** If the string is larger than the TextField width -
>
> * LEFT align should result in - Start of the text visible and end of the text hidden.
> * RIGHT align should result in - End of the text visible at the right edge of the TextField and start of the text hidden.
>
> Right now, only the LEFT align behaves correctly. RIGHT align behaves correctly only if the string is smaller than the TextField width. The moment string length is larger than TextField width, it starts behaving opposite (start of the text visible and end of the text hidden.) I don't know whether there is some rationale for this implementation or it is a bug which went unnoticed till now.
I'm not entirely convinced this is a bug -- it seems quite intentionally built this way.
A reason why you may want to show the left hand side of the text if it doesn't fit is that the exact length of text and the exact size of a (resizable) UI is hard to predict before hand. When presented with a new control where the text doesn't fit, it may make more sense and be more natural to show the user the start of the text.
We may want to check how other UI toolkits are handling these cases.
In any case, this current fix has a problem where the cursor can get lost (field is not scrolled to show it), while the current implementation has no such issues.
-------------
PR: https://git.openjdk.org/jfx/pull/980
More information about the openjfx-dev
mailing list