@@ -102,7 +102,7 @@ import { OpenScmGroupAction } from '../../multiDiffEditor/browser/scmMultiDiffSo
102
102
import { ContentHoverController } from '../../../../editor/contrib/hover/browser/contentHoverController.js' ;
103
103
import { GlyphHoverController } from '../../../../editor/contrib/hover/browser/glyphHoverController.js' ;
104
104
import { ITextModel } from '../../../../editor/common/model.js' ;
105
- import { autorun } from '../../../../base/common/observable.js' ;
105
+ import { autorun , runOnChange } from '../../../../base/common/observable.js' ;
106
106
import { PlaceholderTextContribution } from '../../../../editor/contrib/placeholderText/browser/placeholderTextContribution.js' ;
107
107
import { observableConfigValue } from '../../../../platform/observable/common/platformObservableUtils.js' ;
108
108
import { AccessibilityVerbositySettingId } from '../../accessibility/browser/accessibilityConfiguration.js' ;
@@ -927,8 +927,8 @@ export class SCMAccessibilityProvider implements IListAccessibilityProvider<Tree
927
927
928
928
const kbLabel = this . keybindingService . lookupKeybinding ( AccessibilityCommandId . OpenAccessibilityHelp ) ?. getLabel ( ) ;
929
929
return kbLabel
930
- ? localize ( 'scmInput .accessibilityHelp' , "Source Control Input, Use {0} to open Source Control Accessibility Help." , kbLabel )
931
- : localize ( 'scmInput .accessibilityHelpNoKb' , "Source Control Input, Run the Open Accessibility Help command for more information." ) ;
930
+ ? localize ( 'scmInputRow .accessibilityHelp' , "Source Control Input, Use {0} to open Source Control Accessibility Help." , kbLabel )
931
+ : localize ( 'scmInputRow .accessibilityHelpNoKb' , "Source Control Input, Run the Open Accessibility Help command for more information." ) ;
932
932
} else if ( isSCMActionButton ( element ) ) {
933
933
return element . button ?. command . title ?? '' ;
934
934
} else if ( isSCMResourceGroup ( element ) ) {
@@ -1686,16 +1686,46 @@ class SCMInputWidget {
1686
1686
triggerValidation ( ) ;
1687
1687
} ) ) ;
1688
1688
1689
- // Update placeholder text
1690
- const updatePlaceholderText = ( ) => {
1689
+ // Aria label & placeholder text
1690
+ const accessibilityVerbosityConfig = observableConfigValue (
1691
+ AccessibilityVerbositySettingId . SourceControl , true , this . configurationService ) ;
1692
+
1693
+ const getAriaLabel = ( placeholder : string , verbosity ?: boolean ) => {
1694
+ verbosity = verbosity ?? accessibilityVerbosityConfig . get ( ) ;
1695
+
1696
+ if ( ! verbosity || ! this . accessibilityService . isScreenReaderOptimized ( ) ) {
1697
+ return placeholder ;
1698
+ }
1699
+
1700
+ const kbLabel = this . keybindingService . lookupKeybinding ( AccessibilityCommandId . OpenAccessibilityHelp ) ?. getLabel ( ) ;
1701
+ return kbLabel
1702
+ ? localize ( 'scmInput.accessibilityHelp' , "{0}, Use {1} to open Source Control Accessibility Help." , placeholder , kbLabel )
1703
+ : localize ( 'scmInput.accessibilityHelpNoKb' , "{0}, Run the Open Accessibility Help command for more information." , placeholder ) ;
1704
+ } ;
1705
+
1706
+ const getPlaceholderText = ( ) : string => {
1691
1707
const binding = this . keybindingService . lookupKeybinding ( 'scm.acceptInput' ) ;
1692
1708
const label = binding ? binding . getLabel ( ) : ( platform . isMacintosh ? 'Cmd+Enter' : 'Ctrl+Enter' ) ;
1693
- const placeholderText = format ( input . placeholder , label ) ;
1709
+ return format ( input . placeholder , label ) ;
1710
+ } ;
1694
1711
1695
- this . inputEditor . updateOptions ( { placeholder : placeholderText } ) ;
1712
+ const updatePlaceholderText = ( ) => {
1713
+ const placeholder = getPlaceholderText ( ) ;
1714
+ const ariaLabel = getAriaLabel ( placeholder ) ;
1715
+
1716
+ this . inputEditor . updateOptions ( { ariaLabel, placeholder } ) ;
1696
1717
} ;
1718
+
1697
1719
this . repositoryDisposables . add ( input . onDidChangePlaceholder ( updatePlaceholderText ) ) ;
1698
1720
this . repositoryDisposables . add ( this . keybindingService . onDidUpdateKeybindings ( updatePlaceholderText ) ) ;
1721
+
1722
+ this . repositoryDisposables . add ( runOnChange ( accessibilityVerbosityConfig , verbosity => {
1723
+ const placeholder = getPlaceholderText ( ) ;
1724
+ const ariaLabel = getAriaLabel ( placeholder , verbosity ) ;
1725
+
1726
+ this . inputEditor . updateOptions ( { ariaLabel } ) ;
1727
+ } ) ) ;
1728
+
1699
1729
updatePlaceholderText ( ) ;
1700
1730
1701
1731
// Update input template
@@ -1769,6 +1799,7 @@ class SCMInputWidget {
1769
1799
@ISCMViewService private readonly scmViewService : ISCMViewService ,
1770
1800
@IContextViewService private readonly contextViewService : IContextViewService ,
1771
1801
@IOpenerService private readonly openerService : IOpenerService ,
1802
+ @IAccessibilityService private readonly accessibilityService : IAccessibilityService
1772
1803
) {
1773
1804
this . element = append ( container , $ ( '.scm-editor' ) ) ;
1774
1805
this . editorContainer = append ( this . element , $ ( '.scm-editor-container' ) ) ;
0 commit comments