RFR: 8360070: AccessibleText.getBeforeIndex returns null for last character [v3]
Alexey Ivanov
aivanov at openjdk.org
Wed Aug 6 14:15:06 UTC 2025
On Wed, 6 Aug 2025 07:14:30 GMT, Abhishek Kumar <abhiscxk at openjdk.org> wrote:
> I think the new line character shouldn't be considered from accessibility POV, otherwise, the results returned from get*Index APIs looks incorrect to me.
>
> @azuev-java What are your thoughts on it ?
>
> @aivanov-jdk As per my opinion, updating Accessible Text implementation for JLabel and AbstractButton can be taken up as a separate issue.
I agree this seems weird to me. I have no objections from taking this newly found bug under a new bug id.
The newline character at the start of the message could be required for modelling of HTML in the `Document`, however, off the top of my head, I can't think of any reason why this would be required.
What I also find weird is that all these component implement `AccessibleText` from scratch rather than using an implementation that exists in for a text component. Yes, I understand that it's a nested class and therefore it can't be easily extended, yet there could be an internal class which stores the reference for a text component and or text model and implements the methods on top of that. The implementations for other components could use composition in delegate its implementation of `AccessibleText` to one instance. This would avoid code duplication, and resolving a bug, such as this one, would automatically propagate into other components.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25941#issuecomment-3160352519
More information about the client-libs-dev
mailing list