GP-4296 - Fixed screen reader support of tooltips using html

This commit is contained in:
dragonmacher 2024-02-06 17:29:55 -05:00
parent dffb5fd859
commit 0b0356528d
43 changed files with 349 additions and 342 deletions

View file

@ -182,7 +182,7 @@ public class StatusBar extends JPanel {
*/
public void setStatusText(String text) {
// Run this later in case we are in the midst of a Java focus transition, such as when a
// dialog is closing. If we don't let the focus transition finish, then we will not
// dialog is closing. If we don't let the focus transition finish, then we will not
// correctly locate the active window.
Swing.runLater(() -> doSetStatusText(text));
}
@ -278,7 +278,7 @@ public class StatusBar extends JPanel {
@Override
public String getToolTipText() {
if (messageQueue.size() > 0) {
StringBuffer buffer = new StringBuffer("<HTML>");
StringBuffer buffer = new StringBuffer("<html>");
Iterator<String> iter = messageQueue.iterator();
for (int i = 0; iter.hasNext(); i++) {

View file

@ -52,8 +52,8 @@ class DockingToolBarUtils {
private static String combingToolTipTextWithKeyBinding(String toolTipText,
String keyBindingText) {
StringBuilder buffy = new StringBuilder(toolTipText);
if (StringUtilities.startsWithIgnoreCase(toolTipText, "<HTML>")) {
String endHTMLTag = "</HTML>";
if (StringUtilities.startsWithIgnoreCase(toolTipText, "<html>")) {
String endHTMLTag = "</html>";
int closeTagIndex = StringUtils.indexOfIgnoreCase(toolTipText, endHTMLTag);
if (closeTagIndex < 0) {
// no closing tag, which is acceptable

View file

@ -56,13 +56,13 @@ public class HorizontalRuleAction extends DockingAction {
String topHtml = HTMLUtilities.escapeHTML(topName);
String bottomHtml = HTMLUtilities.escapeHTML(bottomName);
menuData.setMenuItemNamePlain(String.format("""
<HTML><CENTER><FONT SIZE=2 COLOR="%s">%s<BR>%s</FONT></CENTER>
<html><CENTER><FONT SIZE=2 COLOR="%s">%s<BR>%s</FONT></CENTER>
""", Palette.SILVER, topHtml, bottomHtml));
setMenuBarData(menuData);
// the description is meant to be used for the tooltip and is larger
setDescription(String.format("""
<HTML><CENTER><B>%s</B><HR><B>%s</B></CENTER>
<html><CENTER><B>%s</B><HR><B>%s</B></CENTER>
""", PADDING + topHtml + PADDING, PADDING + bottomHtml + PADDING));
}

View file

@ -91,7 +91,7 @@ public class ColorEditor extends PropertyEditorSupport {
String colorString =
WebColors.toString(ColorUtils.contrastForegroundColor(newColor), false);
previewLabel.setText(
"<HTML><CENTER><I><FONT SIZE=2 COLOR=" + colorString + ">click</FONT></I></CENTER>");
"<html><CENTER><I><FONT SIZE=2 COLOR=" + colorString + ">click</FONT></I></CENTER>");
previewLabel.setBackground(color);
}