-
CSR
-
Resolution: Unresolved
-
P4
-
None
-
minimal
Summary
We need to define and implement a new interface that will allow java applications to make announcements through the accessibility subsystem.
Problem
The current implementation of the Java accessibility subsystem does not allow applications to request to speak out the arbitrary string when the application status changes. For example - when an application performs some background task and it wants to announce that the task is complete or when an application requires some action to be done in a specific period of time - like announcing that the current session is about to expire and some input is needed in order to prevent it.
Solution
The idea of the change is to provide an API and implement the native code to make it work on all supported platforms.
If the announcing does not have a native implementation for the current platform, a message will be displayed and a stack trace indicating that there is no implementation.
For MacOS, regardless of whether the announcement succeeded, nothing will be output to the console, since there is no way to get information about the success of the announcement.
For Windows and Linux, the debug build option will print a message to stderr if the declaration fails for one reason or another. If successful, nothing will be printed.
Specification
--- /dev/null +++ b/src/java.desktop/share/classes/javax/accessibility/AccessibleAnnouncer.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.accessibility; + +import javax.accessibility.Accessible; +import java.lang.annotation.Native; + +/** + * This interface provides the ability to speak a given string using screen readers. + */ +public interface AccessibleAnnouncer { + + /** + * messages do not interrupt the current output, they are spoken after the screen reader has spoken the current phrase + */ + @Native int NO_INTERRUPT = 0; + + /** + * messages interrupt current output + */ + @Native int INTERRUPT = 1; + + /** + * This method makes an announcement with the specified priority from an accessible to which the announcing relates + * + * @param a an accessible to which the announcing relates + * @param str string for announcing + * @param priority priority for announcing + */ + void announce(Accessible a, final String str, final int priority); + +}
- csr of
-
JDK-8302352 ☂ Implement accessibility announcement feature
-
- Open
-