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: improving a11y #1070

Merged
merged 8 commits into from
Oct 30, 2023
Merged

feat: improving a11y #1070

merged 8 commits into from
Oct 30, 2023

Conversation

Kyzyl-ool
Copy link
Contributor

@Kyzyl-ool Kyzyl-ool commented Oct 24, 2023

  • ButtonClose has aria-label
  • Persona clickable has focus styles
  • Persona close button has focus style
  • getUniqId exported

closes #685
closes #966

@gravity-ui-bot
Copy link
Contributor

Preview is ready.

@@ -0,0 +1,3 @@
{
"close": "Закрыть"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe "Close dialog"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense

@Kyzyl-ool Kyzyl-ool requested a review from korvin89 October 24, 2023 16:42
@@ -75,6 +75,7 @@ export const Link = React.forwardRef<HTMLElement, LinkProps>(function Link(
const relProp = target === '_blank' && !rel ? 'noopener noreferrer' : rel;

return (
// children is passed in commonProps
Copy link
Contributor

Choose a reason for hiding this comment

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

may be if we pass children explicitly this will pass this lint rule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, you were right

@@ -56,11 +56,27 @@ $block: '.#{variables.$ns}persona';
}
}

&_clickable {
#{$block}__main {
Copy link
Contributor

Choose a reason for hiding this comment

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

Move it to element itself, to have all styles for element in single place

#{$block} {
// ...

  &__main {
    #{$block}_clickable & {
      //
    }
  }

// ...

}

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 was not obvious, but seems useful, thank you

<div className={b('text')}>{children}</div>
</div>
{React.createElement(
clickable ? 'button' : 'div',
Copy link
Contributor

Choose a reason for hiding this comment

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

const MainComponent = clickable ? 'button' : 'div';

<MainComponent/>

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

@@ -136,5 +155,19 @@ $block: '.#{variables.$ns}persona';
&:hover {
color: var(--g-color-text-primary);
}

.yc-icon {
Copy link
Contributor

Choose a reason for hiding this comment

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

add className to icon component

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

@@ -58,3 +58,4 @@ export {useOnFocusOutside} from './utils/useOnFocusOutside';
export * from './utils/interactions';
export * from './utils/xpath';
export {getLayersCount} from './utils/LayerManager';
export {getUniqId} from './utils/common';
Copy link
Contributor

Choose a reason for hiding this comment

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

Exporting useUniqId hook is not enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, as one may use class components

@Kyzyl-ool Kyzyl-ool requested review from ogonkov and amje October 25, 2023 17:09
@@ -137,6 +137,7 @@ const DropdownMenu = <T,>({

return (
<DropdownMenuContext.Provider value={contextValue}>
{/*as this div has Button component as child, clicking on it one fires onClick of this div on bubbling*/}
Copy link
Contributor

Choose a reason for hiding this comment

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

i guess we should make breaking change in future and always add onClick to toggle control

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if button has onClick handler also, it may lead to double-handling of click event. Should be accurate there

@Kyzyl-ool Kyzyl-ool force-pushed the feat/a11y-improvements-2 branch from 620280a to b46148c Compare October 27, 2023 12:01
@Kyzyl-ool Kyzyl-ool force-pushed the feat/a11y-improvements-2 branch from b46148c to b0bd78a Compare October 30, 2023 09:12
@Kyzyl-ool Kyzyl-ool force-pushed the feat/a11y-improvements-2 branch from b0bd78a to f63ee78 Compare October 30, 2023 18:04
@amje amje merged commit 146ff4f into main Oct 30, 2023
3 checks passed
@amje amje deleted the feat/a11y-improvements-2 branch October 30, 2023 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants