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

feat: improve focus outline styles for text/select inputs #1318

Merged
merged 7 commits into from
Mar 21, 2024

Conversation

Kyzyl-ool
Copy link
Contributor

@Kyzyl-ool Kyzyl-ool commented Feb 7, 2024

closes #1043

@Kyzyl-ool Kyzyl-ool requested a review from korvin89 as a code owner February 7, 2024 15:40
@Kyzyl-ool Kyzyl-ool force-pushed the feat/outline-for-text-input-and-select branch from c0782b6 to 95eb0ff Compare February 7, 2024 15:41
@gravity-ui-bot
Copy link
Contributor

Playwright Test Component is ready.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

src/components/Select/README.md Outdated Show resolved Hide resolved
src/components/controls/TextArea/README.md Outdated Show resolved Hide resolved
src/components/controls/TextInput/README.md Outdated Show resolved Hide resolved
@amje
Copy link
Contributor

amje commented Feb 7, 2024

@Kyzyl-ool Currently I see no difference, is it a bug or there is no default?

@Kyzyl-ool
Copy link
Contributor Author

@Kyzyl-ool Currently I see no difference, is it a bug or there is no default?

I left outline color empty by default, so yes – there shouldn't be any differences. Outline on focus for inputs and selects are debatable

@Kyzyl-ool Kyzyl-ool force-pushed the feat/outline-for-text-input-and-select branch from 95eb0ff to 48b1bdf Compare February 8, 2024 09:05
@Kyzyl-ool Kyzyl-ool requested a review from amje February 9, 2024 15:04
@Kyzyl-ool Kyzyl-ool added the a11y Issue or pull request related to accessibility improvements label Feb 26, 2024
@amje
Copy link
Contributor

amje commented Mar 4, 2024

@Kyzyl-ool Maybe we keep default offset to avoid overlapping with border? Error state not visible at all
Снимок экрана 2024-03-04 в 14 07 31

@Kyzyl-ool
Copy link
Contributor Author

Kyzyl-ool commented Mar 4, 2024

@amje , I would like to propose using error state's color for outline color when error state is on. Just added to the previous commit: 48f762c

I like the fact that inputs and selects with error state now at least show focus state with thickened border

@@ -168,6 +168,7 @@ $blockButton: '.#{variables.$ns}select-control__button';

&_error::before {
border-color: var(--g-color-line-danger);
--g-select-focus-outline-color: var(--g-color-line-danger);
Copy link
Contributor

Choose a reason for hiding this comment

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

This wont allow override this variable, we must use private/public pair here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@@ -187,6 +189,10 @@ $block: '.#{variables.$ns}text-area';
&:focus-within {
border-color: var(--g-color-line-danger);
}

&:focus-within {
--g-text-area-focus-outline-color: var(--g-color-line-danger);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

@@ -380,6 +382,10 @@ $block: '.#{variables.$ns}text-input';
&:focus-within {
border-color: var(--g-color-line-danger);
}

&:focus-within {
--g-text-input-focus-outline-color: var(--g-color-line-danger);
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

@Kyzyl-ool Kyzyl-ool requested a review from amje March 14, 2024 09:26
@amje amje changed the title feat: outline for text input and select feat: improve focus outline styles for text/select inputs Mar 21, 2024
Comment on lines 202 to 208
&:focus::before {
outline: 2px solid var(--g-select-focus-outline-color, var(--_--focus-outline-color));
outline-offset: -1px;
}
&:focus:not(:focus-visible)::before {
outline: 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We can now safely use raw :focus-visible selector

@Kyzyl-ool Kyzyl-ool force-pushed the feat/outline-for-text-input-and-select branch from ce7e897 to 1aab151 Compare March 21, 2024 12:40
@Kyzyl-ool Kyzyl-ool force-pushed the feat/outline-for-text-input-and-select branch from 1aab151 to c566f26 Compare March 21, 2024 14:05
@Kyzyl-ool Kyzyl-ool merged commit ce75de8 into main Mar 21, 2024
4 checks passed
@Kyzyl-ool Kyzyl-ool deleted the feat/outline-for-text-input-and-select branch March 21, 2024 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Issue or pull request related to accessibility improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Input elements don't have focus outline
4 participants