Skip to content

chore: minor improvements to focus state #7611

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

Merged
merged 4 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/styles/algolia.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
}

&:focus {
box-shadow: none;
}

&:focus-visible {
transition: none;
background-color: var(--amplify-components-button-hover-background-color);
border-color: var(--amplify-components-button-focus-border-color);
color: var(--amplify-components-button-focus-color);
box-shadow: var(--amplify-components-button-focus-box-shadow);
outline: 2px solid var(--amplify-colors-border-focus);
outline-offset: 2px;
}

.DocSearch-Search-Icon {
Expand Down
15 changes: 14 additions & 1 deletion src/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ a,
text-decoration: none;
}

&:focus {
&:focus-visible {
outline: 2px solid var(--amplify-colors-border-focus);
}
}
Expand Down Expand Up @@ -189,6 +189,14 @@ ol:not([class]) {
}
}

.amplify-button {
&:focus-visible {
transition: none;
outline: 2px solid var(--amplify-colors-border-focus);
outline-offset: 2px;
}
}

.skip-to-main {
position: fixed;
z-index: 201; // GlobalNav is set to 200
Expand All @@ -204,4 +212,9 @@ ol:not([class]) {
white-space: nowrap;
width: 1px;
}
[data-amplify-theme='default-theme'] & {
&:focus-visible {
outline-color: var(--amplify-colors-white);
}
}
}
10 changes: 6 additions & 4 deletions src/styles/code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ hover style on the other */
.code-copy {
--code-copy-hover-background-color: var(--amplify-colors-neutral-90);
--code-copy-focus-background-color: var(--amplify-colors-neutral-90);
--code-copy-focus-box-shadow: var(--amplify-colors-neutral-10);
--code-copy-focus-outline-color: var(--amplify-colors-white);
margin-inline-start: auto;
padding-block: var(--amplify-space-xxxs);
color: var(--amplify-colors-white);
Expand All @@ -260,14 +260,16 @@ hover style on the other */
color: var(--amplify-colors-white);
background-color: var(--code-copy-hover-background-color);
}
&:focus {
&:focus,
&:active {
color: var(--amplify-colors-white);
background-color: var(--code-copy-focus-background-color);
box-shadow: 0 0 0 2px var(--code-copy-focus-box-shadow);
}
&:focus-visible {
outline-color: var(--code-copy-focus-outline-color);
}
@include darkMode {
--code-copy-hover-background-color: var(--amplify-colors-neutral-20);
--code-copy-focus-background-color: var(--amplify-colors-neutral-20);
--code-copy-focus-box-shadow: var(--amplify-colors-neutral-100);
}
}
4 changes: 2 additions & 2 deletions src/styles/feedback.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.feedback {
padding-top: var(--amplify-space-xl);
padding: var(--amplify-space-xl) var(--amplify-space-xxxs)
var(--amplify-space-xxxs);
overflow: hidden;
}

Expand All @@ -12,7 +13,6 @@
font-size: 0.9rem;
justify-content: center;
gap: 0;
// pointer-events: none;
visibility: hidden;
&-no {
&:hover {
Expand Down
6 changes: 2 additions & 4 deletions src/styles/gen-switcher.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
&:hover {
background-color: var(--amplify-colors-primary-90);
}
&:focus {
box-shadow: none;
outline: 2px solid var(--amplify-colors-white);
outline-offset: 2px;
&:focus-visible {
outline-color: var(--amplify-colors-white);
}
.popover-icon {
font-size: var(--amplify-font-sizes-xs);
Expand Down
1 change: 1 addition & 0 deletions src/styles/overview.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
&__link {
color: inherit;
text-decoration: none;
border-radius: var(--amplify-radii-small);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just to make the outline rounded to match the rounded card.


&:hover &__card__title {
color: var(--amplify-colors-primary-60);
Expand Down
11 changes: 9 additions & 2 deletions src/themes/baseTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ export const baseTheme = createTheme({
_focus: {
borderColor: { value: 'transparent' },
boxShadow: {
value: '0 0 0 2px var(--amplify-colors-border-focus)'
value: 'none'
}
},
link: {
_focus: {
boxShadow: {
value: '0 0 0 2px var(--amplify-colors-border-focus)'
value: 'none'
}
}
},
primary: {
_focus: {
boxShadow: {
value: 'none'
}
}
},
Expand Down
5 changes: 1 addition & 4 deletions src/themes/gen1Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ export const gen1Theme = createTheme(
},
_focus: {
backgroundColor: { value: '{colors.primary.20}' },
color: { value: '{colors.font.primary}' },
boxShadow: {
value: '0 0 0 2px var(--amplify-colors-border-focus)'
}
color: { value: '{colors.font.primary}' }
},
_hover: {
backgroundColor: { value: '{colors.primary.20}' },
Expand Down
Loading