Skip to content

Commit 850ff13

Browse files
authored
fix: apply proper focus highlight for multiple header rows (#3016)
1 parent 6d0a403 commit 850ff13

8 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎packages/grid/test/visual/lumo/grid.test.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,23 @@ describe('grid', () => {
253253
it('row focus', async () => {
254254
await visualDiff(element, `${dir}-row-focus`);
255255
});
256+
257+
it('row focus - header', async () => {
258+
// Add a header group
259+
const group = document.createElement('vaadin-grid-column-group');
260+
group.header = 'Address';
261+
group.appendChild(element.querySelector('[path="location.city"]'));
262+
element.appendChild(group);
263+
flushGrid(element);
264+
await nextRender(element);
265+
266+
// Focus a header row
267+
element.tabIndex = 0;
268+
element.focus();
269+
await sendKeys({ press: 'Tab' });
270+
271+
await visualDiff(element, `${dir}-row-focus-header`);
272+
});
256273
});
257274
});
258275
});
17.3 KB
Loading
17.4 KB
Loading

‎packages/grid/test/visual/material/grid.test.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,23 @@ describe('grid', () => {
253253
it('row focus', async () => {
254254
await visualDiff(element, `${dir}-row-focus`);
255255
});
256+
257+
it('row focus - header', async () => {
258+
// Add a header group
259+
const group = document.createElement('vaadin-grid-column-group');
260+
group.header = 'Address';
261+
group.appendChild(element.querySelector('[path="location.city"]'));
262+
element.appendChild(group);
263+
flushGrid(element);
264+
await nextRender(element);
265+
266+
// Focus a header row
267+
element.tabIndex = 0;
268+
element.focus();
269+
await sendKeys({ press: 'Tab' });
270+
271+
await visualDiff(element, `${dir}-row-focus-header`);
272+
});
256273
});
257274
});
258275
});
15.9 KB
Loading
14.8 KB
Loading

‎packages/grid/theme/lumo/vaadin-grid-styles.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ registerStyles(
6060
6161
/* Focus-ring */
6262
63+
[part~='row'] {
64+
position: relative;
65+
}
66+
6367
[part~='row']:focus,
6468
[part~='cell']:focus {
6569
outline: none;

‎packages/grid/theme/material/vaadin-grid-styles.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ registerStyles(
118118
119119
/* Keyboard navigation */
120120
121+
[part~='row'] {
122+
position: relative;
123+
}
124+
121125
[part~='row']:focus,
122126
[part~='cell']:focus {
123127
outline: none;

0 commit comments

Comments
 (0)