Skip to content

Commit

Permalink
browser-specific fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Sep 18, 2024
1 parent 69d9865 commit f0e8234
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions packages/dashboard/src/vaadin-dashboard-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,8 @@ export const dashboardWidgetAndSectionStyles = css`
#remove-button::before {
content: '×';
}
button:focus {
outline: 1px solid blue;
}
`;
16 changes: 13 additions & 3 deletions packages/dashboard/test/dashboard-keyboard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,15 @@ describe('dashboard - keyboard interaction', () => {
root.appendChild(widget);
}
};
document.body.focus();
await nextFrame();

// Make sure the following tab goes back to the first widget
const widget = getElementFromCell(dashboard, 0, 0)!;
widget.focus();
await nextFrame();
await sendKeys({ down: 'Shift' });
await sendKeys({ press: 'Tab' });
await sendKeys({ up: 'Shift' });
await nextFrame();
});

Expand Down Expand Up @@ -115,7 +123,8 @@ describe('dashboard - keyboard interaction', () => {

it('should deselect the widget on blur', async () => {
const widget = getElementFromCell(dashboard, 0, 0)!;
widget.blur();
const anotherWidget = getElementFromCell(dashboard, 0, 1)!;
anotherWidget.focus();
await nextFrame();
expect(widget.hasAttribute('selected')).to.be.false;
expect(widget.hasAttribute('focused')).to.be.false;
Expand Down Expand Up @@ -294,7 +303,8 @@ describe('dashboard - keyboard interaction', () => {
});

it('should deselect the section on blur', async () => {
section.blur();
const anotherWidget = getElementFromCell(dashboard, 0, 1)!;
anotherWidget.focus();
await nextFrame();
expect(section.hasAttribute('selected')).to.be.false;
expect(section.hasAttribute('focused')).to.be.false;
Expand Down

0 comments on commit f0e8234

Please sign in to comment.