Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions webapp/src/components/AreaMenuOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface RectBounds {
height: number;
}

type AreaId = "mainmenu" | "simulator" | "toolbox" | "editor" | "editortools" | "tutorial";
type AreaId = "topbar" | "simulator" | "toolbox" | "workspace" | "bottombar" | "tutorial";

interface Area {
id: AreaId;
Expand All @@ -44,8 +44,8 @@ const isSimMini = () => !!document.querySelector(".miniSim");

const areas: Area[] = [
{
id: "mainmenu",
ariaLabel: lf("Main menu"),
id: "topbar",
ariaLabel: lf("Top bar"),
shortcutKey: "1",
getBounds() {
return document.querySelector("#mainmenu")?.getBoundingClientRect();
Expand Down Expand Up @@ -144,8 +144,8 @@ const areas: Area[] = [
}
},
{
id: "editor",
ariaLabel: lf("Editor"),
id: "workspace",
ariaLabel: lf("Workspace"),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this only be "Workspace" for the Blocks case, and "Editor" for the JavaScript/Python case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think whatever it is should be consistent between experiences. i'm fine with workspace

shortcutKey: "4",
getBounds(projectView: IProjectView) {
const editorSelectors = ["#pxtJsonEditor", "#githubEditor", "#blocksArea", "#serialEditor", "#assetEditor", "#monacoEditor"];
Expand Down Expand Up @@ -180,8 +180,8 @@ const areas: Area[] = [
}
},
{
id: "editortools",
ariaLabel: lf("Editor toolbar"),
id: "bottombar",
ariaLabel: lf("Bottom bar"),
shortcutKey: "5",
getBounds() {
return document.querySelector("#editortools")?.getBoundingClientRect();
Expand Down Expand Up @@ -250,7 +250,7 @@ export const AreaMenuOverlay = ({ parent }: AreaMenuOverlapProps) => {
}, [parent]);

// Something is awry, bail out.
const bailOut = !areaRects.get("editor");
const bailOut = !areaRects.get("workspace");
useEffect(() => {
if (bailOut) {
parent.toggleAreaMenu();
Expand All @@ -261,8 +261,8 @@ export const AreaMenuOverlay = ({ parent }: AreaMenuOverlapProps) => {
return null;
}
return ReactDOM.createPortal(
<FocusTrap dontRestoreFocus onEscape={handleEscape}>
<div className="area-menu-container" >
<FocusTrap dontRestoreFocus onEscape={handleEscape} arrowKeyNavigation={true} focusFirstItem>
<div className="area-menu-container" role="menu" aria-label={lf("Area overlay")}>
{areas.map(area => {
const rect = areaRects.get(area.id);
return rect ? (<AreaButton
Expand Down Expand Up @@ -293,6 +293,7 @@ const AreaButton = ({ shortcutKey, bounds, ...props }: AreaButtonProps) => {
return <Button
{...props}
className={`area-button ${props.className}`}
role="menuitem"
style={{
top, height, left, width
}}
Expand Down
Loading