From 2a7e023ee122f5232af7a20a0ff92d337f9438e1 Mon Sep 17 00:00:00 2001 From: Dmitry Drobotov Date: Tue, 13 May 2025 16:40:10 +0200 Subject: [PATCH] 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 --- .../resources/messages/IdeBundle.properties | 1 + .../src/com/intellij/ide/actions/WhatsNewAction.java | 12 +++++++++--- .../intellij/platform/whatsNew/WhatsNewContent.kt | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/platform/platform-api/resources/messages/IdeBundle.properties b/platform/platform-api/resources/messages/IdeBundle.properties index c113c0bc0d54..320110ff8745 100644 --- a/platform/platform-api/resources/messages/IdeBundle.properties +++ b/platform/platform-api/resources/messages/IdeBundle.properties @@ -1015,6 +1015,7 @@ whats.new.timeout.message=The content for this page cannot be loaded. Please che whats.new.timeout.action=You can open this page in browser 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}'' diff --git a/platform/platform-impl/src/com/intellij/ide/actions/WhatsNewAction.java b/platform/platform-impl/src/com/intellij/ide/actions/WhatsNewAction.java index 9c132cc18916..d5d2151f0295 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/WhatsNewAction.java +++ b/platform/platform-impl/src/com/intellij/ide/actions/WhatsNewAction.java @@ -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))) diff --git a/platform/whatsNew/src/com/intellij/platform/whatsNew/WhatsNewContent.kt b/platform/whatsNew/src/com/intellij/platform/whatsNew/WhatsNewContent.kt index 6a5b08467db2..34fd2a29b3e0 100644 --- a/platform/whatsNew/src/com/intellij/platform/whatsNew/WhatsNewContent.kt +++ b/platform/whatsNew/src/com/intellij/platform/whatsNew/WhatsNewContent.kt @@ -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 {