From 6bcd0529c1564376846a11de0341dfe006f8522d Mon Sep 17 00:00:00 2001 From: Joe Wegner Date: Thu, 15 Aug 2019 07:14:08 -0400 Subject: [PATCH] Add in accessibility support for screen readers: ContributedLibraryTableCellJPanel.java: Add description to accessibility context ContributedPlatformTableCellJPanel.java: Add description to accessibility context ProgressJProgressBar.java: Add status to accessibility context make progress bar focusable so screen reader can access --- .../libraries/ui/ContributedLibraryTableCellJPanel.java | 2 ++ .../packages/ui/ContributedPlatformTableCellJPanel.java | 2 ++ .../cc/arduino/contributions/ui/ProgressJProgressBar.java | 7 ++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java index d4382cf5147..ec5c09181e0 100644 --- a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java +++ b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellJPanel.java @@ -193,6 +193,8 @@ public ContributedLibraryTableCellJPanel(JTable parentTable, Object value, desc += ""; description.setText(desc); + // copy description to accessibility context for screen readers to use + description.getAccessibleContext().setAccessibleDescription(desc); description.setBackground(Color.WHITE); // for modelToView to work, the text area has to be sized. It doesn't diff --git a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java index b4537ce94cc..7a2750a7eb9 100644 --- a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java +++ b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellJPanel.java @@ -230,6 +230,8 @@ void update(JTable parentTable, Object value, boolean isSelected, desc += ""; description.setText(desc); + // copy description to accessibility context for screen readers to use + description.getAccessibleContext().setAccessibleDescription(desc); description.setBackground(Color.WHITE); // for modelToView to work, the text area has to be sized. It doesn't diff --git a/app/src/cc/arduino/contributions/ui/ProgressJProgressBar.java b/app/src/cc/arduino/contributions/ui/ProgressJProgressBar.java index 12b39742fa3..7c946e4993e 100644 --- a/app/src/cc/arduino/contributions/ui/ProgressJProgressBar.java +++ b/app/src/cc/arduino/contributions/ui/ProgressJProgressBar.java @@ -38,8 +38,13 @@ public class ProgressJProgressBar extends JProgressBar { public void setValue(Progress p) { setValue((int) p.getProgress()); - if (p.getStatus() != null) + if (p.getStatus() != null) { setString(p.getStatus()); + // copy status to accessibility context for screen readers to use + getAccessibleContext().setAccessibleDescription(p.getStatus()); + // make status focusable so screen readers can get to it + setFocusable(true); + } } }