-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(components): fix the language switch keyboard navigation (#4340)
The changes to the post-menu are part of the PR #4337 that should be merge before this one. :information_source: **Only the commit b899725 needs to be reviewed in this PR.** --------- Co-authored-by: Lea <[email protected]>
- Loading branch information
1 parent
790b811
commit f5054b1
Showing
19 changed files
with
121 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@swisspost/design-system-documentation': major | ||
'@swisspost/design-system-components': major | ||
--- | ||
|
||
Renamed the "dropdown" variant to "menu" for the `post-language-switch` and `post-language-option` components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 63 additions & 61 deletions
124
packages/components/src/components/post-language-option/post-language-option.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,83 +1,85 @@ | ||
@use '@swisspost/design-system-styles/core' as post; | ||
|
||
:host { | ||
post-language-option { | ||
display: inline-block; | ||
} | ||
|
||
:host([variant='dropdown']) { | ||
width: 100%; | ||
} | ||
|
||
button { | ||
@include post.reset-button; | ||
} | ||
button { | ||
@include post.reset-button; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
|
||
:is(a, button) { | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100%; | ||
width: 100%; | ||
padding: var(--post-language-option-padding); | ||
:is(a, button) { | ||
cursor: pointer; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 100%; | ||
width: 100%; | ||
padding: var(--post-language-option-padding); | ||
} | ||
} | ||
|
||
.post-language-option-list { | ||
@include post.focus-style; | ||
border-radius: 2px; | ||
width: 40px; | ||
height: 40px; | ||
post-language-option:where([variant='list']) { | ||
:is(a, button) { | ||
@include post.focus-style; | ||
border-radius: 2px; | ||
width: 40px; | ||
height: 40px; | ||
|
||
&:hover { | ||
color: #504f4b; | ||
} | ||
&:hover { | ||
color: #504f4b; | ||
} | ||
|
||
&[aria-current='true'], | ||
&[aria-current='page'] { | ||
background-color: #050400; | ||
color: #fff; | ||
&[aria-current='true'], | ||
&[aria-current='page'] { | ||
background-color: #050400; | ||
color: #fff; | ||
|
||
&:hover { | ||
background-color: #504f4b; | ||
&:hover { | ||
background-color: #504f4b; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.post-language-option-dropdown { | ||
padding-block: 13px; | ||
padding-inline: 24px; | ||
box-sizing: border-box; | ||
position: relative; | ||
post-language-option:where([variant='menu']) { | ||
width: 100%; | ||
|
||
&[aria-current='true'], | ||
&[aria-current='page'] { | ||
&::after { | ||
content: ''; | ||
left: -2px; | ||
height: 3px; | ||
background-color: #050400; | ||
width: calc(100% + 4px); | ||
display: block; | ||
position: absolute; | ||
bottom: 3px; | ||
} | ||
:is(a, button) { | ||
padding-block: 13px; | ||
padding-inline: 24px; | ||
box-sizing: border-box; | ||
position: relative; | ||
|
||
&:focus::after { | ||
width: calc(100% - 5px); | ||
left: 2px; | ||
} | ||
&[aria-current='true'], | ||
&[aria-current='page'] { | ||
&::after { | ||
content: ''; | ||
left: -2px; | ||
height: 3px; | ||
background-color: #050400; | ||
width: calc(100% + 4px); | ||
display: block; | ||
position: absolute; | ||
bottom: 3px; | ||
} | ||
|
||
&:focus::after { | ||
width: calc(100% - 5px); | ||
left: 2px; | ||
} | ||
|
||
&:hover::after { | ||
background-color: #504f4b; | ||
&:hover::after { | ||
background-color: #504f4b; | ||
} | ||
} | ||
} | ||
|
||
&:hover { | ||
color: #504f4b; | ||
&:hover { | ||
color: #504f4b; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/components/src/components/post-language-switch/switch-variants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const SWITCH_VARIANTS = ['list', 'dropdown'] as const; | ||
export const SWITCH_VARIANTS = ['list', 'menu'] as const; | ||
|
||
export type SwitchVariant = (typeof SWITCH_VARIANTS)[number]; |
3 changes: 0 additions & 3 deletions
3
packages/components/src/components/post-menu-item/post-menu-item.scss
This file was deleted.
Oops, something went wrong.
6 changes: 1 addition & 5 deletions
6
packages/components/src/components/post-menu-item/post-menu-item.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.