Skip to content

Commit

Permalink
fix(ToolbarSeparator): use "separator" role to announce separator (#…
Browse files Browse the repository at this point in the history
…5810)

Fixes #5808
  • Loading branch information
Lukas742 authored May 16, 2024
1 parent cecce78 commit 9471454
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/main/src/components/Toolbar/Toolbar.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ describe('Toolbar', () => {
<Text>Item3</Text>
</Toolbar>
);
cy.findByLabelText('Separator').should('be.visible');
cy.findByRole('separator').should('be.visible');
});

it('toolbarStyle', () => {
Expand Down
8 changes: 2 additions & 6 deletions packages/main/src/components/ToolbarSeparator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use client';

import { useI18nBundle, useStylesheet } from '@ui5/webcomponents-react-base';
import { useStylesheet } from '@ui5/webcomponents-react-base';
import { clsx } from 'clsx';
import React, { forwardRef } from 'react';
import { SEPARATOR } from '../../i18n/i18n-defaults.js';
import type { CommonProps } from '../../types/index.js';
import { classNames, styleData } from './ToolbarSeparator.module.css.js';

Expand All @@ -19,11 +18,8 @@ const ToolbarSeparator = forwardRef<HTMLDivElement, ToolbarSeparatorPropTypes>((

useStylesheet(styleData, ToolbarSeparator.displayName);
const separatorClasses = clsx(classNames.separator, className);
const i18nBundle = useI18nBundle('@ui5/webcomponents-react');

return (
<div ref={ref} style={style} className={separatorClasses} aria-label={i18nBundle.getText(SEPARATOR)} {...rest} />
);
return <div ref={ref} style={style} className={separatorClasses} role="separator" {...rest} />;
});
ToolbarSeparator.displayName = 'ToolbarSeparator';
export { ToolbarSeparator };

0 comments on commit 9471454

Please sign in to comment.