Skip to content
Permalink
Browse files
7124301: [macosx] When in a tab group if you arrow between tabs there…
… are no VoiceOver announcements.

Reviewed-by: goetz
Backport-of: 2146e52
  • Loading branch information
TheRealMDoerr committed May 20, 2022
1 parent 3072af4 commit 8533ba4dced40df80302f9e477029719e7ccc78f
Showing 3 changed files with 33 additions and 3 deletions.
@@ -32,6 +32,7 @@
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.JProgressBar;
import javax.swing.JTabbedPane;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@@ -42,6 +43,8 @@
import static javax.accessibility.AccessibleContext.ACCESSIBLE_STATE_PROPERTY;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_TABLE_MODEL_CHANGED;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY;
import static javax.accessibility.AccessibleContext.ACCESSIBLE_NAME_PROPERTY;

import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
import sun.awt.AWTAccessor;
@@ -67,6 +70,7 @@ public static CAccessible getCAccessible(final Accessible a) {
private static native void valueChanged(long ptr);
private static native void selectedTextChanged(long ptr);
private static native void selectionChanged(long ptr);
private static native void titleChanged(long ptr);
private static native void menuOpened(long ptr);
private static native void menuClosed(long ptr);
private static native void menuItemSelected(long ptr);
@@ -122,9 +126,9 @@ public void propertyChange(PropertyChangeEvent e) {
Object oldValue = e.getOldValue();
if (name.compareTo(ACCESSIBLE_CARET_PROPERTY) == 0) {
selectedTextChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0 ) {
} else if (name.compareTo(ACCESSIBLE_TEXT_PROPERTY) == 0) {
valueChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0 ) {
} else if (name.compareTo(ACCESSIBLE_SELECTION_PROPERTY) == 0) {
selectionChanged(ptr);
} else if (name.compareTo(ACCESSIBLE_TABLE_MODEL_CHANGED) == 0) {
valueChanged(ptr);
@@ -160,6 +164,11 @@ public void propertyChange(PropertyChangeEvent e) {
}
}
}
} else if (name.compareTo(ACCESSIBLE_NAME_PROPERTY) == 0) {
//for now trigger only for JTabbedPane.
if (e.getSource() instanceof JTabbedPane) {
titleChanged(ptr);
}
}
}
}
@@ -52,6 +52,7 @@
- (void)postValueChanged;
- (void)postSelectedTextChanged;
- (void)postSelectionChanged;
- (void)postTitleChanged;
- (BOOL)isEqual:(id)anObject;
- (BOOL)isAccessibleWithEnv:(JNIEnv *)env forAccessible:(jobject)accessible;

@@ -245,6 +245,12 @@ - (void)postSelectionChanged
NSAccessibilityPostNotification(self, NSAccessibilitySelectedChildrenChangedNotification);
}

-(void)postTitleChanged
{
AWT_ASSERT_APPKIT_THREAD;
NSAccessibilityPostNotification(self, NSAccessibilityTitleChangedNotification);
}

- (void)postMenuOpened
{
AWT_ASSERT_APPKIT_THREAD;
@@ -544,7 +550,8 @@ - (NSArray *)initializeAttributeNamesWithEnv:(JNIEnv *)env
if (attributeStatesArray[6]) {
[attributeNames addObject:NSAccessibilityChildrenAttribute];
if ([javaRole isEqualToString:@"list"]
|| [javaRole isEqualToString:@"table"]) {
|| [javaRole isEqualToString:@"table"]
|| [javaRole isEqualToString:@"pagetablist"]) {
[attributeNames addObject:NSAccessibilitySelectedChildrenAttribute];
[attributeNames addObject:NSAccessibilityVisibleChildrenAttribute];
}
@@ -1531,6 +1538,19 @@ - (id)accessibilityFocusedUIElement
JNI_COCOA_EXIT(env);
}

/*
* Class: sun_lwawt_macosx_CAccessible
* Method: titleChanged
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_sun_lwawt_macosx_CAccessible_titleChanged
(JNIEnv *env, jclass jklass, jlong element)
{
JNI_COCOA_ENTER(env);
[ThreadUtilities performOnMainThread:@selector(postTitleChanged) on:(JavaComponentAccessibility*)jlong_to_ptr(element) withObject:nil waitUntilDone:NO];
JNI_COCOA_EXIT(env);
}

/*
* Class: sun_lwawt_macosx_CAccessible
* Method: valueChanged

1 comment on commit 8533ba4

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 8533ba4 May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.