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: added focus styles for interactive elements #576

Merged
merged 12 commits into from
Oct 18, 2023
Merged

Conversation

Kyzyl-ool
Copy link
Contributor

No description provided.

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@Kyzyl-ool Kyzyl-ool marked this pull request as draft September 21, 2023 13:09
@Kyzyl-ool Kyzyl-ool marked this pull request as ready for review October 5, 2023 08:30
@Kyzyl-ool Kyzyl-ool force-pushed the feat/focus-styles branch 6 times, most recently from 664b9b9 to d553cae Compare October 12, 2023 08:10
@@ -60,6 +60,12 @@ $block: '.#{$ns}content-layout-block';
padding: $indentXL;
}

&_theme {
&_dark {
--g-color-line-focus: var(--g-color-text-light-primary);
Copy link
Contributor

@yuberdysheva yuberdysheva Oct 14, 2023

Choose a reason for hiding this comment

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

What color is default for --g-color-line-focus in uikit and why can't we use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let's use default focus color in page-constructor

@@ -251,7 +251,7 @@ export const SliderBlock = (props: WithChildren<SliderProps>) => {
return (
// To have this key differ from keys used in renderDot function, added `-accessible-bar` part
<Fragment key={`${index}-accessible-bar`}>
{slidesCountByBreakpoint > 1 && (
{slidesCountByBreakpoint > 0 && (
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you change the value? Could it break something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I change it because when we have slidesCountByBreakpoint === 1 the accessible bar didn't render and one was unable to find it vis screenreader


return (
slidesCountByBreakpoint > 0 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Something wrong with a slider. I can tab trough cards and then if I click to the arrow it doesn't work right
https://disk.yandex.ru/i/7dRgmxUNMis7iA

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, this is an issue I think came from react-slick, I didn't manage to find a solution better than wrap each slide with inert attribute. But it may be risky, as slides not visible for the user, will be unavailable for focus

@@ -391,6 +391,7 @@ export const ReactPlayerBlock = React.forwardRef<ReactPlayerBlockHandler, ReactP
onProgress={onProgress}
onEnded={onEnded}
aria-label={ariaLabel}
previewTabIndex={-1}
Copy link
Contributor

Choose a reason for hiding this comment

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

What does it mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It means that preview image will not be focusable with Tab. At the same time we have on preview image play button, which is also accessible via Tab. I thought it would be sufficient to have it focusable

@@ -259,7 +264,15 @@ $block: '.#{$ns}hubspot-form';
p {
color: var(--g-color-text-primary);
@include text-body-2();
margin: 0 0 20px;
margin: 20px 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use variable instead of 20px?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep

@Kyzyl-ool
Copy link
Contributor Author

Introduced focus variables:

--pc-color-line-focus-light
--pc-color-line-focus-dark

yuberdysheva
yuberdysheva previously approved these changes Oct 17, 2023
@@ -44,19 +44,24 @@ const FullscreenImage = (props: FullscreenImageProps) => {
onClick={openModal}
style={imageStyle}
/>
<div className={b('icon-wrapper', {visible: isMouseEnter})} onClick={openModal}>
<button
Copy link
Collaborator

Choose a reason for hiding this comment

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

did we reset button styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

<div
className={b('media-wrapper')}
onClickCapture={openModal}
onMouseOver={onShowFullScreenButton}
Copy link
Collaborator

Choose a reason for hiding this comment

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

:hover in css doesn't suite this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

suits, rewrote with pseudoclasses

@@ -71,14 +71,14 @@ const PriceDetails = (props: PriceDetailsExtendProps) => {

const getFoldableTitle = () => {
return (
<div
<button
Copy link
Collaborator

Choose a reason for hiding this comment

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

did we reset button styles?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

also yes

@Kyzyl-ool Kyzyl-ool merged commit 4c6dd96 into main Oct 18, 2023
3 checks passed
@Kyzyl-ool Kyzyl-ool deleted the feat/focus-styles branch October 18, 2023 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants