Skip to content

Commit

Permalink
fix: zoom menu trigger should not gain focus on close
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 authored and tiensonqin committed Nov 28, 2022
1 parent 4c95293 commit e7e630d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ export const ZoomMenu = observer(function ZoomMenu(): JSX.Element {
<DropdownMenuPrimitive.Trigger className="tl-button text-sm px-2 important" id="tl-zoom">
{(app.viewport.camera.zoom * 100).toFixed(0) + '%'}
</DropdownMenuPrimitive.Trigger>
<DropdownMenuPrimitive.Content className="tl-menu" id="zoomPopup" sideOffset={12}>
<DropdownMenuPrimitive.Content
onCloseAutoFocus={e => e.preventDefault()}
className="tl-menu"
id="zoomPopup"
sideOffset={12}
>
<DropdownMenuPrimitive.Item
className="tl-menu-item"
onSelect={preventEvent}
Expand Down
2 changes: 0 additions & 2 deletions tldraw/packages/react/src/components/Canvas/Canvas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ export const Canvas = observer(function Renderer<S extends TLReactShape>({
const erasingShapesSet = React.useMemo(() => new Set(erasingShapes || []), [erasingShapes])
const singleSelectedShape = selectedShapes?.length === 1 ? selectedShapes[0] : undefined

const selectedOrHooveredShape = hoveredShape || singleSelectedShape

return (
<div ref={rContainer} className={`tl-container ${className ?? ''}`}>
<div tabIndex={-1} className="tl-absolute tl-canvas" {...events}>
Expand Down

0 comments on commit e7e630d

Please sign in to comment.