Skip to content

Commit

Permalink
fix: apply proper focus highlight for multiple header rows (#3016) (#…
Browse files Browse the repository at this point in the history
…3022)

Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
  • Loading branch information
vaadin-bot and tomivirkki committed Nov 11, 2021
1 parent 9020006 commit 2232031
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/grid/test/visual/lumo/grid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ describe('grid', () => {
it('row focus', async () => {
await visualDiff(element, `${dir}-row-focus`);
});

it('row focus - header', async () => {
// Add a header group
const group = document.createElement('vaadin-grid-column-group');
group.header = 'Address';
group.appendChild(element.querySelector('[path="location.city"]'));
element.appendChild(group);
flushGrid(element);
await nextRender(element);

// Focus a header row
element.tabIndex = 0;
element.focus();
await sendKeys({ press: 'Tab' });

await visualDiff(element, `${dir}-row-focus-header`);
});
});
});
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions packages/grid/test/visual/material/grid.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ describe('grid', () => {
it('row focus', async () => {
await visualDiff(element, `${dir}-row-focus`);
});

it('row focus - header', async () => {
// Add a header group
const group = document.createElement('vaadin-grid-column-group');
group.header = 'Address';
group.appendChild(element.querySelector('[path="location.city"]'));
element.appendChild(group);
flushGrid(element);
await nextRender(element);

// Focus a header row
element.tabIndex = 0;
element.focus();
await sendKeys({ press: 'Tab' });

await visualDiff(element, `${dir}-row-focus-header`);
});
});
});
});
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/grid/theme/lumo/vaadin-grid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ registerStyles(
/* Focus-ring */
[part~='row'] {
position: relative;
}
[part~='row']:focus,
[part~='cell']:focus {
outline: none;
Expand Down
4 changes: 4 additions & 0 deletions packages/grid/theme/material/vaadin-grid-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ registerStyles(
/* Keyboard navigation */
[part~='row'] {
position: relative;
}
[part~='row']:focus,
[part~='cell']:focus {
outline: none;
Expand Down

0 comments on commit 2232031

Please sign in to comment.