Skip to content

Commit 6ce6b99

Browse files
feat(AsideHeader, Logo)!: make actions accessible with keyboard (#305)
* test: playwright cache (#312) * feat(AsideHeader, Logo)!: make actions accessible with keyboard --------- Co-authored-by: Egor Mostovoy <[email protected]>
1 parent a59d352 commit 6ce6b99

27 files changed

+107
-114
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ build
1313
pnpm-lock.yaml
1414

1515
#Playwright
16-
/playwright/playwright/.cache
17-
/playwright-report
16+
.cache*
17+
playwright-report*
1818
/test-results
1919

2020
# other files

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"playwright:install": "playwright install --with-deps",
3434
"playwright": "playwright test --config=playwright/playwright.config.ts",
3535
"playwright:update": "npm run playwright -- -u",
36+
"playwright:clear-cache": "rm -rf ./playwright/.cache",
3637
"playwright:docker": "./scripts/playwright-docker.sh 'npm run playwright'",
3738
"playwright:docker:update": "./scripts/playwright-docker.sh 'npm run playwright:update'",
3839
"playwright:docker:clear-cache": "./scripts/playwright-docker.sh clear-cache"

playwright/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
- `npm run playwright:install` - install playwright browsers and dependencies
119119
- `npm run playwright` - run tests
120120
- `npm run playwright:update` - update screenshots
121+
- `npm run playwright:clear-cache` - clear cache vite
121122
- `npm run playwright:docker` - run tests using docker
122123
- `npm run playwright:docker:update` - update screenshots using docker
123-
- `npm run playwright:docker:clear-cache` - clear node_modules cache for docker container
124+
- `npm run playwright:docker:clear-cache` - clear node_modules cache for docker container and clear cache vite

playwright/playwright.config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ reporter.push(
1717
'html',
1818
{
1919
open: process.env.CI ? 'never' : 'on-failure',
20-
outputFolder: resolve(process.cwd(), 'playwright-report'),
20+
outputFolder: resolve(
21+
process.cwd(),
22+
process.env.IS_DOCKER ? 'playwright-report-docker' : 'playwright-report',
23+
),
2124
},
2225
],
2326
);
@@ -53,6 +56,7 @@ const config: PlaywrightTestConfig = {
5356
/* Port to use for Playwright component endpoint. */
5457
screenshot: 'only-on-failure',
5558
timezoneId: 'UTC',
59+
ctCacheDir: process.env.IS_DOCKER ? '.cache-docker' : '.cache',
5660
ctViteConfig: {
5761
//@ts-ignore
5862
plugins: [

scripts/playwright-docker.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ run_command() {
1515
$CONTAINER_TOOL run --rm --network host -it -w /work \
1616
-v $(pwd):/work \
1717
-v "$NODE_MODULES_CACHE_DIR:/work/node_modules" \
18+
-e IS_DOCKER=1 \
1819
"$IMAGE_NAME:$IMAGE_TAG" \
1920
/bin/bash -c "$1"
2021
}
@@ -30,6 +31,7 @@ fi
3031

3132
if [[ "$1" = "clear-cache" ]]; then
3233
rm -rf "$NODE_MODULES_CACHE_DIR"
34+
rm -rf "./playwright/.cache-docker"
3335
exit 0
3436
fi
3537

src/components/AllPagesPanel/AllPagesListItem/AllPagesListItem.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
@use '../../variables';
2+
@use '../../../../styles/mixins';
23

34
.#{variables.$ns}all-pages-list-item {
5+
@include mixins.accessibility-button;
6+
47
display: flex;
58
align-items: center;
69

@@ -11,6 +14,7 @@
1114

1215
&__text {
1316
flex: 1;
17+
text-align: initial;
1418
}
1519

1620
&__icon {

src/components/AllPagesPanel/AllPagesListItem/AllPagesListItem.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,17 @@ export const AllPagesListItem: React.FC<AllPagesListItemProps> = (props) => {
2727
[onToggle],
2828
);
2929

30-
const onItemClick = (e: MouseEvent<HTMLDivElement>) => {
30+
const onItemClick = (e: MouseEvent<HTMLElement>) => {
3131
if (editMode) {
3232
e.stopPropagation();
3333
e.preventDefault();
3434
}
3535
};
36+
37+
const [Tag, tagProps] = item.link ? ['a' as const, {href: item.link}] : ['button' as const, {}];
38+
3639
return (
37-
<div className={b()} onClick={onItemClick}>
40+
<Tag {...tagProps} className={b()} onClick={onItemClick}>
3841
{item.icon ? (
3942
<Icon className={b('icon')} data={item.icon} size={item.iconSize} />
4043
) : null}
@@ -47,6 +50,6 @@ export const AllPagesListItem: React.FC<AllPagesListItemProps> = (props) => {
4750
<Button.Icon>{item.hidden ? <Pin /> : <PinFill />}</Button.Icon>
4851
</Button>
4952
)}
50-
</div>
53+
</Tag>
5154
);
5255
};

src/components/AsideHeader/AsideHeader.scss

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,20 +182,14 @@ $block: '.#{variables.$ns}aside-header';
182182
}
183183
}
184184

185-
&__logo-button-wrapper {
185+
&__logo-button &__logo-icon-place {
186+
height: var(
187+
--gn-aside-header-item-icon-background-size,
188+
var(--_--item-icon-background-size)
189+
);
186190
width: var(--gn-aside-header-min-width);
187191
}
188192

189-
&__logo-button[class] {
190-
&,
191-
.g-button__icon {
192-
height: var(
193-
--gn-aside-header-item-icon-background-size,
194-
var(--_--item-icon-background-size)
195-
);
196-
}
197-
}
198-
199193
&__menu-items {
200194
flex-grow: 1;
201195
}

src/components/AsideHeader/AsideHeaderContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface AsideHeaderInnerContextType extends AsideHeaderInnerProps {
1010
onItemClick: (
1111
item: MenuItem,
1212
collapsed: boolean,
13-
event: React.MouseEvent<HTMLDivElement, MouseEvent>,
13+
event: React.MouseEvent<HTMLElement, MouseEvent>,
1414
) => void;
1515
}
1616

src/components/AsideHeader/components/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ export const Header = () => {
3333
{...logo}
3434
onClick={onLogoClick}
3535
compact={compact}
36-
buttonWrapperClassName={b('logo-button-wrapper')}
3736
buttonClassName={b('logo-button')}
37+
iconPlaceClassName={b('logo-icon-place')}
3838
/>
3939
)}
4040

0 commit comments

Comments
 (0)