mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-59438 Fallback to opening What's New in the browser if screen reader support is on
Screen readers don't work with JCEF content, so we don't need to open it in the editor. Instead, fallback to opening the What's New URL in the browser or show a notification with the link. GitOrigin-RevId: 30350f8c8a758f17928bb87de1c4613042803ad1
This commit is contained in:
committed by
intellij-monorepo-bot
parent
26d26d0caa
commit
2a7e023ee1
@@ -1015,6 +1015,7 @@ whats.new.timeout.message=The content for this page cannot be loaded. Please che
|
||||
whats.new.timeout.action=You can <a href="{0}" class="link" target="_blank">open this page in browser</a> or try again later.
|
||||
# 0 - IDE name (e.g. "IntelliJ IDEA"), 1 - IDE version (e.g. "2020.3")
|
||||
whats.new.notification.text={0} {1} est arriv\u00E9!
|
||||
whats.new.notification.text.regular.language={0} {1} has arrived!
|
||||
whats.new.notification.action=See what's new
|
||||
|
||||
diff.dialog.title=Diff Between ''{0}'' and ''{1}''
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.util.Urls;
|
||||
import com.intellij.util.system.CpuArch;
|
||||
import com.intellij.util.system.OS;
|
||||
import com.intellij.util.ui.StartupUiUtil;
|
||||
import com.intellij.util.ui.accessibility.ScreenReader;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -68,7 +69,7 @@ public final class WhatsNewAction extends AnAction implements DumbAware {
|
||||
}
|
||||
|
||||
var project = e.getProject();
|
||||
if (project != null && JBCefApp.isSupported()) {
|
||||
if (project != null && JBCefApp.isSupported() && !ScreenReader.isActive()) {
|
||||
openWhatsNewPage(project, url, false);
|
||||
}
|
||||
else {
|
||||
@@ -78,11 +79,16 @@ public final class WhatsNewAction extends AnAction implements DumbAware {
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void openWhatsNewPage(@NotNull Project project, @NotNull String url, boolean onUpgrade) {
|
||||
if (!JBCefApp.isSupported()) {
|
||||
if (!JBCefApp.isSupported() ||
|
||||
// JCEF is not accessible for screen readers (IJPL-59438), so also fallback to the notification
|
||||
ScreenReader.isActive()) {
|
||||
var name = ApplicationNamesInfo.getInstance().getFullProductName();
|
||||
var version = ApplicationInfo.getInstance().getShortVersion();
|
||||
String notificationText =
|
||||
IdeBundle.message(ScreenReader.isActive() ? "whats.new.notification.text.regular.language" : "whats.new.notification.text", name,
|
||||
version);
|
||||
UpdateChecker.getNotificationGroupForIdeUpdateResults()
|
||||
.createNotification(IdeBundle.message("whats.new.notification.text", name, version), NotificationType.INFORMATION)
|
||||
.createNotification(notificationText, NotificationType.INFORMATION)
|
||||
.setIcon(AllIcons.Nodes.PpWeb)
|
||||
.setDisplayId("ide.whats.new")
|
||||
.addAction(NotificationAction.createSimpleExpiring(IdeBundle.message("whats.new.notification.action"), () -> BrowserUtil.browse(url)))
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.intellij.ui.jcef.JBCefApp
|
||||
import com.intellij.util.application
|
||||
import com.intellij.util.io.DigestUtil
|
||||
import com.intellij.util.ui.StartupUiUtil
|
||||
import com.intellij.util.ui.accessibility.ScreenReader
|
||||
import kotlinx.coroutines.DelicateCoroutinesApi
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
@@ -38,7 +39,9 @@ import java.net.URL
|
||||
internal abstract class WhatsNewContent() {
|
||||
companion object {
|
||||
suspend fun getWhatsNewContent(): WhatsNewContent? {
|
||||
return if (WhatsNewInVisionContentProvider.getInstance().isAvailable()) {
|
||||
return if (WhatsNewInVisionContentProvider.getInstance().isAvailable() &&
|
||||
// JCEF is not accessible for screen readers (IJPL-59438), so also need to open the page in the browser
|
||||
!ScreenReader.isActive()) {
|
||||
val provider = WhatsNewInVisionContentProvider.getInstance()
|
||||
WhatsNewVisionContent(provider, provider.getContent().entities.first())
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user