@@ -33,6 +33,25 @@ protected internal void SetSearchString(T value)
3333 internal string _searchString { get ; set ; }
3434 private readonly string multiSelectionText ;
3535 private IKeyInterceptor _keyInterceptor ;
36+ static readonly KeyInterceptorOptions _keyInterceptorOptions = new ( )
37+ {
38+ //EnableLogging = true,
39+ TargetClass = "mud-input-control" ,
40+ Keys =
41+ {
42+ new KeyOptions { Key = " " , PreventDown = "key+none" } , //prevent scrolling page, toggle open/close
43+ new KeyOptions { Key = "ArrowUp" , PreventDown = "key+none" } , // prevent scrolling page, instead hilight previous item
44+ new KeyOptions { Key = "ArrowDown" , PreventDown = "key+none" } , // prevent scrolling page, instead hilight next item
45+ new KeyOptions { Key = "Home" , PreventDown = "key+none" } ,
46+ new KeyOptions { Key = "End" , PreventDown = "key+none" } ,
47+ new KeyOptions { Key = "Escape" } ,
48+ new KeyOptions { Key = "Enter" , PreventDown = "key+none" } ,
49+ new KeyOptions { Key = "NumpadEnter" , PreventDown = "key+none" } ,
50+ new KeyOptions { Key = "a" , PreventDown = "key+ctrl" } , // select all items instead of all page text
51+ new KeyOptions { Key = "A" , PreventDown = "key+ctrl" } , // select all items instead of all page text
52+ new KeyOptions { Key = "/./" , SubscribeDown = true , SubscribeUp = true } , // for our users
53+ }
54+ } ;
3655
3756 public List < MudComboBoxItem < T > > Items { get ; set ; } = new ( ) ;
3857 internal MudComboBoxItem < T > _lastActivatedItem ;
@@ -702,24 +721,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
702721 if ( firstRender )
703722 {
704723 _keyInterceptor = KeyInterceptorFactory . Create ( ) ;
705- await _keyInterceptor . Connect ( _elementId , new KeyInterceptorOptions ( )
706- {
707- //EnableLogging = true,
708- TargetClass = "mud-input-control" ,
709- Keys = {
710- new KeyOptions { Key = " " , PreventDown = "key+none" } , //prevent scrolling page, toggle open/close
711- new KeyOptions { Key = "ArrowUp" , PreventDown = "key+none" } , // prevent scrolling page, instead hilight previous item
712- new KeyOptions { Key = "ArrowDown" , PreventDown = "key+none" } , // prevent scrolling page, instead hilight next item
713- new KeyOptions { Key = "Home" , PreventDown = "key+none" } ,
714- new KeyOptions { Key = "End" , PreventDown = "key+none" } ,
715- new KeyOptions { Key = "Escape" } ,
716- new KeyOptions { Key = "Enter" , PreventDown = "key+none" } ,
717- new KeyOptions { Key = "NumpadEnter" , PreventDown = "key+none" } ,
718- new KeyOptions { Key = "a" , PreventDown = "key+ctrl" } , // select all items instead of all page text
719- new KeyOptions { Key = "A" , PreventDown = "key+ctrl" } , // select all items instead of all page text
720- new KeyOptions { Key = "/./" , SubscribeDown = true , SubscribeUp = true } , // for our users
721- } ,
722- } ) ;
724+ await _keyInterceptor . Connect ( _elementId , _keyInterceptorOptions ) ;
723725 _keyInterceptor . KeyDown += HandleKeyDown ;
724726 _keyInterceptor . KeyUp += HandleKeyUp ;
725727 await UpdateDataVisualiserTextAsync ( ) ;
0 commit comments