On Tue, 28 Feb 2023 07:25:29 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:
>> JAccessWalker was not able to show component tree correctly if we switch >> pages for HTML content. >> >> Observation: >> The issue observed is that the children are not reported correct for root >> element when switching of pages happened. The reason behind it is that the >> `getAccessibleChildrenCount` API is called on the old `accessibleContext` >> object which return the children count as 0. Whenever we switch the page the >> children count is recalculated based on the root element but the >> `accessibleContext `object used to retrieve the child remains unchanged and >> due to that it return the children count 0. >> >> Solution: >> >> Added a condition check to create a new `accessibleContext `object to find >> out the children count correctly whenever we switch the pages in >> JEditorPane. >> >> Checked with the SwingSet2 JEditorPane demo and it reports well the >> component tree in JAccessWalker. >> >> Steps to verify: >> >> JBS contains the steps to reproduce the scenario. > > Abhishek Kumar has updated the pull request incrementally with one additional > commit since the last revision: > > Review comment update src/java.desktop/share/classes/javax/swing/text/html/AccessibleHTML.java line 189: > 187: > rootHTMLAccessibleContext.setElementInfo(rootElementInfo); > 188: } > 189: rootElementInfo.validate(); probably we should call validate first, so it will be in the valid state before being leaked to the "setElementInfo" method. ------------- PR: https://git.openjdk.org/jdk/pull/12707