@@ -608,12 +608,14 @@ export interface SideDocsState {
608608interface BuiltInHelpDetails {
609609 component : ( ) => JSX . Element ;
610610 popOutHref : string ;
611+ singleTabStop : boolean ; // if the whole doc is only one tab stop, the "open in new tab" button placement becomes unintuitive.
611612}
612613
613614const builtIns : Record < pxt . editor . BuiltInHelp , BuiltInHelpDetails > = {
614615 "keyboardControls" : {
615616 component : KeyboardControlsHelp ,
616- popOutHref : "https://makecode.com/accessibility"
617+ popOutHref : "https://makecode.com/accessibility" ,
618+ singleTabStop : true
617619 }
618620}
619621
@@ -778,20 +780,27 @@ export class SideDocs extends data.Component<SideDocsProps, SideDocsState> {
778780 tabIndex : 0 ,
779781 } ;
780782
783+ const openInNewTab = ! lockedEditor && < div className = "ui app hide" id = "sidedocsbar" >
784+ < a className = "ui icon link" aria-label = { lf ( "Open documentation in new tab" ) } { ...openInNewTabLinkProps } >
785+ < sui . Icon icon = "external" />
786+ </ a >
787+ </ div > ;
788+
789+ const content = < div id = "sidedocsframe-wrapper" >
790+ { this . renderContent ( url , builtIn , lockedEditor ) }
791+ </ div > ;
792+
793+ const flipNewTabLinkOrder = builtIn ?. singleTabStop ;
794+
795+ const contentParts = flipNewTabLinkOrder ? [ content , openInNewTab ] : [ openInNewTab , content ] ;
796+
781797 /* eslint-disable @microsoft/sdl/react-iframe-missing-sandbox */
782798 return < div >
783799 < button id = "sidedocstoggle" role = "button" aria-label = { sideDocsCollapsed ? lf ( "Expand the side documentation" ) : lf ( "Collapse the side documentation" ) } className = "ui icon button large" onClick = { this . toggleVisibility } >
784800 < sui . Icon icon = { `icon inverted chevron ${ showLeftChevron ? 'left' : 'right' } ` } />
785801 </ button >
786802 < div id = "sidedocs" onKeyDown = { this . handleKeyDown } >
787- { ! lockedEditor && < div className = "ui app hide" id = "sidedocsbar" >
788- < a className = "ui icon link" aria-label = { lf ( "Open documentation in new tab" ) } { ...openInNewTabLinkProps } >
789- < sui . Icon icon = "external" />
790- </ a >
791- </ div > }
792- < div id = "sidedocsframe-wrapper" >
793- { this . renderContent ( url , builtIn , lockedEditor ) }
794- </ div >
803+ { contentParts }
795804 </ div >
796805 </ div >
797806 /* eslint-enable @microsoft/sdl/react-iframe-missing-sandbox */
0 commit comments