Skip to content

Commit cc012a0

Browse files
fix: hide crud editor focus ring from pointer events (#7339) (#7340)
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
1 parent 778749a commit cc012a0

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

packages/crud/test/crud-editor.test.js

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect } from '@esm-bundle/chai';
2-
import { fixtureSync, nextRender } from '@vaadin/testing-helpers';
2+
import { aTimeout, fixtureSync, nextRender } from '@vaadin/testing-helpers';
33
import { setViewport } from '@web/test-runner-commands';
44
import '../vaadin-crud.js';
55
import { flushGrid } from './helpers.js';
@@ -11,6 +11,16 @@ describe('crud editor', () => {
1111
await setViewport({ width: 1024, height: 768 });
1212
});
1313

14+
afterEach(async () => {
15+
// Wait until the crud dialog overlay is closed
16+
let overlay;
17+
while ((overlay = document.querySelector('body > vaadin-crud-dialog-overlay'))) {
18+
// Press esc to close the dialog
19+
overlay.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
20+
await aTimeout(1);
21+
}
22+
});
23+
1424
describe('header', () => {
1525
let header;
1626

@@ -122,6 +132,22 @@ describe('crud editor', () => {
122132
expect(form.parentElement).to.be.null;
123133
expect(newForm.parentElement).to.equal(overlay);
124134
});
135+
136+
it('should not cover the editor content with focus ring element', async () => {
137+
// Open the editor
138+
crud.editorPosition = 'aside';
139+
crud._newButton.click();
140+
await nextRender();
141+
142+
// Get the elementFromPoint of the editor header
143+
const header = crud.querySelector('[slot=header]');
144+
const headerRect = header.getBoundingClientRect();
145+
const x = headerRect.left + headerRect.width / 2;
146+
const y = headerRect.top + headerRect.height / 2;
147+
const elementFromPoint = document.elementFromPoint(x, y);
148+
149+
expect(elementFromPoint).to.equal(header);
150+
});
125151
});
126152
});
127153
});

packages/crud/theme/lumo/vaadin-crud-styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ registerStyles(
108108
inset: 0;
109109
content: '';
110110
box-shadow: inset 0 0 0 var(--_focus-ring-width) var(--_focus-ring-color);
111+
pointer-events: none;
111112
}
112113
113114
:host(:not([editor-position=''])) [part='editor']:not([hidden]) {

packages/crud/theme/material/vaadin-crud-styles.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ registerStyles(
8383
inset: 0;
8484
content: '';
8585
box-shadow: inset 0 0 0 2px var(--material-primary-color);
86+
pointer-events: none;
8687
}
8788
8889
[part='toolbar'] {

0 commit comments

Comments
 (0)