On Wed, 2 Sep 2026 14:22:34 GMT, Florian Kirmaier <[email protected]> wrote:

> When the index of an IndexedCell is changed with 
> `IndexedCell.indexChanged(int, int)`
> then currently no `INDEX` accessibility notification is sent.
> 
> And when the selected element changes, then no `SELECTED` notification is 
> sent.
> 
> As a result, assistive technology is not informed and it breaks the rule - 
> that for every change
> to the accessibility attributes must be notified with 
> `Node.notifyAccessibleAttributeChanged(attribute)`.
> 
> The change is on the
> base classes, so it covers `ListCell`, `TableCell`, `TableRow`, `TreeCell`,
> `TreeTableCell`, and `TreeTableRow`.
> 
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

I've also made a PR in parallel - which would allow to write reasonable 
unit-tests for accessibility.
With that change - one could add tests to ListCellTest like the following:


    private List<AccessibleAttribute> observeCellAttributes(Runnable change) {
        List<AccessibleAttribute> seen = new ArrayList<>();
        AccessibleAttributeObserver observer = (n, a) -> { if (n == cell) 
seen.add(a); };
        Accessibility.addAccessibleAttributeObserver(observer);
        try {
            change.run();
        } finally {
            Accessibility.removeAccessibleAttributeObserver(observer);
        }
        return seen;
    }

    @Test
    public void indexChangeNotifiesAccessibility() {
        assertTrue(observeCellAttributes(() -> 
cell.updateIndex(3)).contains(AccessibleAttribute.INDEX));
    }

    @Test
    public void selectionChangeNotifiesAccessibility() {
        cell.updateListView(list);
        cell.updateIndex(0);
        assertTrue(observeCellAttributes(() -> 
cell.updateSelected(true)).contains(AccessibleAttribute.SELECTED));
    }

Without the TestAPI - it is still an important bugfix.

done now. Should now be RFR.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2288#issuecomment-5511299878
PR Comment: https://git.openjdk.org/jfx/pull/2288#issuecomment-6194320102
PR Comment: https://git.openjdk.org/jfx/pull/2288#issuecomment-6494945455

Reply via email to