File tree Expand file tree Collapse file tree 4 files changed +24
-1
lines changed
src/vs/editor/contrib/hover/browser Expand file tree Collapse file tree 4 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -321,6 +321,10 @@ export class ContentHoverController extends Disposable implements IHoverWidget {
321
321
this . _contentHoverWidget . focus ( ) ;
322
322
}
323
323
324
+ public focusHoverPartWithIndex ( index : number ) : void {
325
+ this . _renderedContentHover ?. focusHoverPartWithIndex ( index ) ;
326
+ }
327
+
324
328
public scrollUp ( ) : void {
325
329
this . _contentHoverWidget . scrollUp ( ) ;
326
330
}
Original file line number Diff line number Diff line change @@ -77,6 +77,10 @@ export class RenderedContentHover extends Disposable {
77
77
return this . _renderedHoverParts . focusedHoverPartIndex ;
78
78
}
79
79
80
+ public focusHoverPartWithIndex ( index : number ) : void {
81
+ this . _renderedHoverParts . focusHoverPartWithIndex ( index ) ;
82
+ }
83
+
80
84
public getAccessibleWidgetContent ( ) : string {
81
85
return this . _renderedHoverParts . getAccessibleContent ( ) ;
82
86
}
@@ -328,6 +332,13 @@ class RenderedContentHoverParts extends Disposable {
328
332
this . _colorHoverParticipant = participants . find ( p => p instanceof ColorHoverParticipant ) ;
329
333
}
330
334
335
+ public focusHoverPartWithIndex ( index : number ) : void {
336
+ if ( index < 0 || index >= this . _renderedParts . length ) {
337
+ return ;
338
+ }
339
+ this . _renderedParts [ index ] . hoverElement . focus ( ) ;
340
+ }
341
+
331
342
public getAccessibleContent ( ) : string {
332
343
const content : string [ ] = [ ] ;
333
344
for ( let i = 0 ; i < this . _renderedParts . length ; i ++ ) {
Original file line number Diff line number Diff line change @@ -117,8 +117,12 @@ abstract class BaseHoverAccessibleViewProvider extends Disposable implements IAc
117
117
if ( ! this . _hoverController ) {
118
118
return ;
119
119
}
120
+ if ( this . _focusedHoverPartIndex === - 1 ) {
121
+ this . _hoverController . focus ( ) ;
122
+ } else {
123
+ this . _hoverController . focusHoverPartWithIndex ( this . _focusedHoverPartIndex ) ;
124
+ }
120
125
this . _focusedHoverPartIndex = - 1 ;
121
- this . _hoverController . focus ( ) ;
122
126
this . _hoverController . shouldKeepOpenOnEditorMouseMoveOrLeave = false ;
123
127
this . dispose ( ) ;
124
128
}
Original file line number Diff line number Diff line change @@ -433,6 +433,10 @@ export class HoverController extends Disposable implements IEditorContribution {
433
433
this . _contentWidget ?. focus ( ) ;
434
434
}
435
435
436
+ public focusHoverPartWithIndex ( index : number ) : void {
437
+ this . _contentWidget ?. focusHoverPartWithIndex ( index ) ;
438
+ }
439
+
436
440
public scrollUp ( ) : void {
437
441
this . _contentWidget ?. scrollUp ( ) ;
438
442
}
You can’t perform that action at this time.
0 commit comments