diff --git a/src/Monaco/index.html b/src/Monaco/index.html
index 54f7524225bf..fd17ceab5755 100644
--- a/src/Monaco/index.html
+++ b/src/Monaco/index.html
@@ -71,6 +71,18 @@
/*Hides alert box */
display: none !important
}
+
+ /* Fix for text selection in High Contrast Mode */
+ @media (forced-colors: active) {
+ .monaco-editor .focused .selected-text {
+ background-color: Highlight !important;
+ color: HighlightText !important;
+ }
+ .monaco-editor .selected-text {
+ background-color: Highlight !important;
+ color: HighlightText !important;
+ }
+ }
diff --git a/src/modules/registrypreview/RegistryPreviewUILib/Assets/RegistryPreview/index.html b/src/modules/registrypreview/RegistryPreviewUILib/Assets/RegistryPreview/index.html
index 95ae2d3d4e79..76b8157f5c55 100644
--- a/src/modules/registrypreview/RegistryPreviewUILib/Assets/RegistryPreview/index.html
+++ b/src/modules/registrypreview/RegistryPreviewUILib/Assets/RegistryPreview/index.html
@@ -26,6 +26,18 @@
/*Hides alert box */
display: none !important
}
+
+ /* Fix for text selection in High Contrast Mode */
+ @media (forced-colors: active) {
+ .monaco-editor .focused .selected-text {
+ background-color: Highlight !important;
+ color: HighlightText !important;
+ }
+ .monaco-editor .selected-text {
+ background-color: Highlight !important;
+ color: HighlightText !important;
+ }
+ }