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(core/event-list): add focus-visible outline #1467

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions .changeset/gold-owls-whisper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@siemens/ix": patch
---

fix(core/event-list): add focus-visible outline
11 changes: 11 additions & 0 deletions packages/core/src/components/event-list-item/event-list-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ $default-event-list-item-height: 2.5rem;

:host {
@include ix-component;
display: block;
position: relative;

.event-list-item {
display: flex;
Expand Down Expand Up @@ -129,4 +131,13 @@ $default-event-list-item-height: 2.5rem;
}
}

:host(:focus) {
outline: none;
}

:host(:focus-visible) {
outline: 1px solid var(--theme-color-focus-bdr);
outline-offset: var(--theme-btn--focus--outline-offset);
}

@include host-disabled;
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class EventListItem {

return (
<Host
tabIndex="0"
class={{
disabled: this.disabled,
}}
Expand Down
47 changes: 41 additions & 6 deletions packages/core/src/tests/event-list/event-list.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,68 @@
* LICENSE file in the root directory of this source tree.
*/

import { expect } from '@playwright/test';
import { expect, Page } from '@playwright/test';
import { regressionTest } from '@utils/test';

const basicUrl = 'event-list/basic';
const compactUrl = 'event-list/compact';
const chevronUrl = 'event-list/chevron';
const customHeightUrl = 'event-list/custom-height';

async function pressTab(page: Page, count: number) {
for (let i = 0; i < count; i++) {
await page.keyboard.press('Tab');
}
}

regressionTest.describe('event-list', () => {
regressionTest('basic', async ({ page }) => {
await page.goto('event-list/basic');
await page.goto(basicUrl);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('compact', async ({ page }) => {
await page.goto('event-list/compact');
await page.goto(compactUrl);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('chevron', async ({ page }) => {
await page.goto('event-list/chevron');
await page.goto(chevronUrl);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('custom-height', async ({ page }) => {
await page.goto('event-list/custom-height');
await page.goto(customHeightUrl);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('hover', async ({ page }) => {
await page.goto('event-list/basic');
await page.goto(basicUrl);
await (await page.waitForSelector('text="Text 3"')).hover();
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('outline', async ({ page }) => {
await page.goto(basicUrl);
await pressTab(page, 2);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('outline selected', async ({ page }) => {
await page.goto(basicUrl);
await pressTab(page, 3);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('outline compact', async ({ page }) => {
await page.goto(compactUrl);
await pressTab(page, 3);
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});

regressionTest('outline compact selected', async ({ page }) => {
await page.goto(compactUrl);
await pressTab(page, 3);
danielleroux marked this conversation as resolved.
Show resolved Hide resolved
expect(await page.screenshot({ fullPage: true })).toMatchSnapshot();
});
});
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.
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.
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.
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.
Loading