Skip to content

fix: ensure wysiwyg editor clickable area #803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/bundle/WysiwygEditorView.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
&__editor {
overflow-y: auto;
flex-grow: 1;

// Ensure empty editor has clickable area
min-height: 36px;
padding: var(--g-md-editor-padding);

.g-root_theme_dark & .pm-iframe-container {
Expand Down
16 changes: 16 additions & 0 deletions tests/visual-tests/ClickableArea.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {test, expect} from 'playwright/core';
import {PresetsStories} from './Presets.helpers';

const getHeights = async (page) => {
const container = page.locator('.g-md-wysiwyg-editor__editor');
const editor = container.locator('.ProseMirror');
const containerBox = await container.boundingBox();
const editorBox = await editor.boundingBox();
return {containerHeight: containerBox?.height, editorHeight: editorBox?.height};
};

test('zero preset clickable area', async ({mount, page}) => {
await mount(<PresetsStories.Zero />);
const {containerHeight, editorHeight} = await getHeights(page);
expect(containerHeight).toBeCloseTo(editorHeight!, 1);
});
Loading