Skip to content

Commit

Permalink
Merge pull request #581 from components-ai/input-selection-handling
Browse files Browse the repository at this point in the history
Prevent browser focus handling for labels and inputs in the canvas
  • Loading branch information
johno authored Aug 23, 2022
2 parents 62e085a + c9b6365 commit beb5440
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/witty-lions-compete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@compai/css-gui': patch
---

Disable browser label/input selection handling in the canvas
42 changes: 42 additions & 0 deletions apps/docs/data/initial-html-editor-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1634,4 +1634,46 @@ export const initialComponents: any = [
],
},
},
{
type: 'component',
id: 'ddeeff123',
tagName: 'Input',
attributes: {},
value: {
type: 'element',
tagName: 'input',
attributes: {},
style: {},
},
},
{
type: 'component',
id: 'ddeeff456',
tagName: 'Email Input',
attributes: {},
value: {
tagName: 'label',
attributes: {},
style: {},
children: [
{
type: 'element',
tagName: 'span',
attributes: {},
children: [{ type: 'text', value: 'Email' }],
},
{
type: 'component',
tagName: 'Input',
attributes: {},
value: {
type: 'element',
tagName: 'input',
attributes: {},
style: {},
},
},
],
},
},
]
2 changes: 1 addition & 1 deletion packages/gui/src/components/html/Component/Provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function ComponentProvider({
} = useHtmlEditor()
const selectComponent = (e: MouseEvent) => {
setSelected(path)
e.stopPropagation()
e.stopImmediatePropagation()
}

const updateComponent = (fullEditPath: ElementPath, newValue: HtmlNode) => {
Expand Down

1 comment on commit beb5440

@vercel
Copy link

@vercel vercel bot commented on beb5440 Aug 23, 2022

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

css-gui – ./

css-gui-git-main-components-ai.vercel.app
css-gui.vercel.app
css-gui-components-ai.vercel.app

Please sign in to comment.