Fix focus to match portal (#56)

This commit is contained in:
Laurent Nguyen 2020-06-26 16:52:28 +02:00 committed by GitHub
parent e5fc6f2022
commit 1d3b672a14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 11 deletions

View File

@ -54,6 +54,8 @@
@SelectionColor: #3074B0; @SelectionColor: #3074B0;
@FocusColor: #00bcf2;
/****************************************************************************** /******************************************************************************
METRICS METRICS
/******************************************************************************/ /******************************************************************************/
@ -198,7 +200,7 @@
} }
.focus() { .focus() {
outline: 1px dashed @AccentMedium; outline: 1px dashed @FocusColor;
} }
/************************************************************************************************ /************************************************************************************************

View File

@ -14,6 +14,10 @@ body {
font-family: @DataExplorerFont; font-family: @DataExplorerFont;
font-size: 12px; font-size: 12px;
height: 100%; height: 100%;
:focus {
.focus()
}
} }
.float-right { .float-right {

View File

@ -133,7 +133,7 @@ export const FeaturePanelComponent: React.FunctionComponent = () => {
.find(f => f.key === "feature.notebookserverurl") .find(f => f.key === "feature.notebookserverurl")
.reactState[1]("https://localhost:10001/12345/notebook/"); .reactState[1]("https://localhost:10001/12345/notebook/");
stringFeatures.find(f => f.key === "feature.notebookservertoken").reactState[1]("token"); stringFeatures.find(f => f.key === "feature.notebookservertoken").reactState[1]("token");
stringFeatures.find(f => f.key === "feature.notebookbasepath").reactState[1]("."); stringFeatures.find(f => f.key === "feature.notebookbasepath").reactState[1]("./notebooks");
setPlatform(platformOptions.find(o => o.key === "Hosted")); setPlatform(platformOptions.find(o => o.key === "Hosted"));
}; };

View File

@ -6,10 +6,9 @@
*/ */
import * as React from "react"; import * as React from "react";
import * as ReactDOM from "react-dom";
import * as Constants from "../../../Common/Constants"; import * as Constants from "../../../Common/Constants";
import AnimateHeight from "react-animate-height"; import AnimateHeight from "react-animate-height";
import { IconButton } from "office-ui-fabric-react/lib/Button"; import { IconButton, IButtonStyles } from "office-ui-fabric-react/lib/Button";
import { import {
DirectionalHint, DirectionalHint,
IContextualMenuItemProps, IContextualMenuItemProps,
@ -227,6 +226,10 @@ export class TreeNodeComponent extends React.Component<TreeNodeComponentProps, T
private renderContextMenuButton(node: TreeNode): JSX.Element { private renderContextMenuButton(node: TreeNode): JSX.Element {
const menuItemLabel = "More"; const menuItemLabel = "More";
const buttonStyles: Partial<IButtonStyles> = {
rootFocused: { outline: `1px dashed ${Constants.StyleConstants.FocusColor}` }
};
return ( return (
<div ref={this.contextMenuRef} onContextMenu={this.onRightClick} onKeyPress={this.onMoreButtonKeyPress}> <div ref={this.contextMenuRef} onContextMenu={this.onRightClick} onKeyPress={this.onMoreButtonKeyPress}>
<IconButton <IconButton
@ -264,6 +267,7 @@ export class TreeNodeComponent extends React.Component<TreeNodeComponentProps, T
onRenderIcon: (props: any) => <img src={menuItem.iconSrc} alt="" /> onRenderIcon: (props: any) => <img src={menuItem.iconSrc} alt="" />
})) }))
}} }}
styles={buttonStyles}
/> />
</div> </div>
); );

View File

@ -191,6 +191,13 @@ exports[`TreeNodeComponent renders a simple node (sorted children, expanded) 1`]
} }
} }
name="More" name="More"
styles={
Object {
"rootFocused": Object {
"outline": "1px dashed undefined",
},
}
}
/> />
</div> </div>
</div> </div>
@ -314,6 +321,13 @@ exports[`TreeNodeComponent renders sorted children, expanded, leaves and parents
} }
} }
name="More" name="More"
styles={
Object {
"rootFocused": Object {
"outline": "1px dashed undefined",
},
}
}
/> />
</div> </div>
</div> </div>