@@ -1292,9 +1292,12 @@ class GridsetProcessor extends BaseProcessor {
12921292 break ;
12931293
12941294 case 'Jump.ToKeyboard' : {
1295- // Navigate to the set keyboard if we found one in settings
1295+ // Prefer explicit keyboard page metadata when available.
1296+ // Some Gridsets resolve the keyboard page in metadata
1297+ // without preserving tree.keyboardGridName during parse.
12961298 const keyboardGridName = ( tree as any ) . keyboardGridName as string ;
1297- const keyboardPageId = gridNameToIdMap . get ( keyboardGridName ) ;
1299+ const keyboardPageId =
1300+ tree . metadata ?. defaultKeyboardPageId || gridNameToIdMap . get ( keyboardGridName ) ;
12981301 if ( keyboardPageId && ! navigationTarget ) {
12991302 navigationTarget = keyboardPageId ;
13001303 }
@@ -1900,6 +1903,7 @@ class GridsetProcessor extends BaseProcessor {
19001903 settingsData ?. gridSetSettings ?. keyboardGrid ||
19011904 settingsData ?. GridsetSettings ?. KeyboardGrid ;
19021905 if ( keyboardGridName && typeof keyboardGridName === 'string' ) {
1906+ ( tree as any ) . keyboardGridName = keyboardGridName ;
19031907 metadata . defaultKeyboardPageId = gridNameToIdMap . get ( keyboardGridName ) ;
19041908 }
19051909 }
@@ -1909,6 +1913,24 @@ class GridsetProcessor extends BaseProcessor {
19091913
19101914 // Set metadata on tree
19111915 tree . metadata = metadata ;
1916+ if ( metadata . defaultKeyboardPageId ) {
1917+ Object . values ( tree . pages ) . forEach ( ( page ) => {
1918+ page . buttons . forEach ( ( button ) => {
1919+ if (
1920+ button ?. semanticAction ?. platformData ?. grid3 ?. commandId === 'Jump.ToKeyboard' &&
1921+ ! button . targetPageId
1922+ ) {
1923+ button . targetPageId = metadata . defaultKeyboardPageId ;
1924+ if ( button . semanticAction ) {
1925+ button . semanticAction . targetId = metadata . defaultKeyboardPageId ;
1926+ if ( button . semanticAction . fallback ?. type === 'NAVIGATE' ) {
1927+ button . semanticAction . fallback . targetPageId = metadata . defaultKeyboardPageId ;
1928+ }
1929+ }
1930+ }
1931+ } ) ;
1932+ } ) ;
1933+ }
19121934
19131935 return tree ;
19141936 }
0 commit comments