On Mon, 27 Feb 2023 04:51:50 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:
>> src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java line >> 690: >> >>> 688: if (accessibleContext == null >>> 689: || doc != theEditor.getDocument()) { >>> 690: AccessibleHTML a = new AccessibleHTML(theEditor); >> >> The "AccessibleHTML" internally registers the listener on the editor to >> update the state/doc. Why that notification does not work and it is >> necessary to recreate the "AccessibleHTML" here? > > The "AccessibleHTML" does internally register the listener on the editor to > update the state/doc. > > But the `rootHTMLAccessibleContext` is not updated/created for the new root > element on doc change and when `getAccessibleChildrenCount` is called it > returns the child count 0, because the API is get called on the old object. if the "rootHTMLAccessibleContext" depends on the doc then I think it should be updated in that listener at the same moment the doc is replaced. especially taking into account that the "rootElementInfo" is updated already. ------------- PR: https://git.openjdk.org/jdk/pull/12707