@@ -24,6 +24,9 @@ export class AccessibilityService extends Disposable implements IAccessibilitySe
24
24
protected _systemMotionReduced : boolean ;
25
25
protected readonly _onDidChangeReducedMotion = new Emitter < void > ( ) ;
26
26
27
+ private _linkUnderlinesEnabled : boolean ;
28
+ protected readonly _onDidChangeLinkUnderline = new Emitter < void > ( ) ;
29
+
27
30
constructor (
28
31
@IContextKeyService private readonly _contextKeyService : IContextKeyService ,
29
32
@ILayoutService private readonly _layoutService : ILayoutService ,
@@ -50,7 +53,10 @@ export class AccessibilityService extends Disposable implements IAccessibilitySe
50
53
this . _systemMotionReduced = reduceMotionMatcher . matches ;
51
54
this . _configMotionReduced = this . _configurationService . getValue < 'auto' | 'on' | 'off' > ( 'workbench.reduceMotion' ) ;
52
55
56
+ this . _linkUnderlinesEnabled = this . _configurationService . getValue ( 'accessibility.underlineLinks' ) ;
57
+
53
58
this . initReducedMotionListeners ( reduceMotionMatcher ) ;
59
+ this . initLinkUnderlineListeners ( ) ;
54
60
}
55
61
56
62
private initReducedMotionListeners ( reduceMotionMatcher : MediaQueryList ) {
@@ -72,6 +78,29 @@ export class AccessibilityService extends Disposable implements IAccessibilitySe
72
78
this . _register ( this . onDidChangeReducedMotion ( ( ) => updateRootClasses ( ) ) ) ;
73
79
}
74
80
81
+ private initLinkUnderlineListeners ( ) {
82
+ this . _register ( this . _configurationService . onDidChangeConfiguration ( e => {
83
+ if ( e . affectsConfiguration ( 'accessibility.underlineLinks' ) ) {
84
+ const linkUnderlinesEnabled = this . _configurationService . getValue < boolean > ( 'accessibility.underlineLinks' ) ;
85
+ this . _linkUnderlinesEnabled = linkUnderlinesEnabled ;
86
+ this . _onDidChangeLinkUnderline . fire ( ) ;
87
+ }
88
+ } ) ) ;
89
+
90
+ const updateLinkUnderlineClasses = ( ) => {
91
+ const underlineLinks = this . _linkUnderlinesEnabled ;
92
+ this . _layoutService . mainContainer . classList . toggle ( 'underline-links' , underlineLinks ) ;
93
+ } ;
94
+
95
+ updateLinkUnderlineClasses ( ) ;
96
+
97
+ this . _register ( this . onDidChangeLinkUnderlines ( ( ) => updateLinkUnderlineClasses ( ) ) ) ;
98
+ }
99
+
100
+ public onDidChangeLinkUnderlines ( listener : ( ) => void ) {
101
+ return this . _onDidChangeLinkUnderline . event ( listener ) ;
102
+ }
103
+
75
104
get onDidChangeScreenReaderOptimized ( ) : Event < void > {
76
105
return this . _onDidChangeScreenReaderOptimized . event ;
77
106
}
0 commit comments