Skip to content
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

fix: hide crud editor focus ring from pointer events #7339

Merged
merged 1 commit into from
Apr 16, 2024
Merged
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
28 changes: 27 additions & 1 deletion packages/crud/test/crud-editor.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from '@esm-bundle/chai';
import { fixtureSync, nextRender } from '@vaadin/testing-helpers';
import { aTimeout, fixtureSync, nextRender } from '@vaadin/testing-helpers';
import { setViewport } from '@web/test-runner-commands';
import '../vaadin-crud.js';
import { flushGrid } from './helpers.js';
Expand All @@ -11,6 +11,16 @@ describe('crud editor', () => {
await setViewport({ width: 1024, height: 768 });
});

afterEach(async () => {
// Wait until the crud dialog overlay is closed
let overlay;
while ((overlay = document.querySelector('body > vaadin-crud-dialog-overlay'))) {
// Press esc to close the dialog
overlay.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
await aTimeout(1);
}
});

describe('header', () => {
let header;

Expand Down Expand Up @@ -122,6 +132,22 @@ describe('crud editor', () => {
expect(form.parentElement).to.be.null;
expect(newForm.parentElement).to.equal(overlay);
});

it('should not cover the editor content with focus ring element', async () => {
// Open the editor
crud.editorPosition = 'aside';
crud._newButton.click();
await nextRender();

// Get the elementFromPoint of the editor header
const header = crud.querySelector('[slot=header]');
const headerRect = header.getBoundingClientRect();
const x = headerRect.left + headerRect.width / 2;
const y = headerRect.top + headerRect.height / 2;
const elementFromPoint = document.elementFromPoint(x, y);

expect(elementFromPoint).to.equal(header);
});
});
});
});
1 change: 1 addition & 0 deletions packages/crud/theme/lumo/vaadin-crud-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ registerStyles(
inset: 0;
content: '';
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
pointer-events: none;
}

:host(:not([editor-position=''])) [part='editor']:not([hidden]) {
Expand Down
1 change: 1 addition & 0 deletions packages/crud/theme/material/vaadin-crud-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ registerStyles(
inset: 0;
content: '';
box-shadow: inset 0 0 0 2px var(--material-primary-color);
pointer-events: none;
}

[part='toolbar'] {
Expand Down
Loading