[MM-61637]: Add accessible name to the expand RHS button in RHS header (#29783)
* [MA-48]: Add aria-label * [MA-48]: Update snapshots * [MA-48]: Fix E2E tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bf541446cf
Коммит
2d61d13940
@@ -35,11 +35,7 @@ describe('Verify Accessibility Support in different Buttons', () => {
|
||||
within(() => {
|
||||
// * Verify accessibility support in Sidebar Expand and Shrink icon
|
||||
cy.get('button.sidebar--right__expand').
|
||||
should('have.attr', 'aria-label', 'Expand').
|
||||
within(() => {
|
||||
cy.get('.icon-arrow-expand').should('have.attr', 'aria-label', 'Expand Sidebar Icon');
|
||||
cy.get('.icon-arrow-collapse').should('have.attr', 'aria-label', 'Collapse Sidebar Icon');
|
||||
});
|
||||
should('have.attr', 'aria-label', 'Expand Sidebar Icon');
|
||||
|
||||
// * Verify accessibility support in Close icon
|
||||
cy.get('#rhsCloseButton').
|
||||
|
||||
@@ -19,7 +19,7 @@ Cypress.Commands.add('uiCloseRHS', () => {
|
||||
});
|
||||
|
||||
Cypress.Commands.add('uiExpandRHS', () => {
|
||||
cy.findByLabelText('Expand').click();
|
||||
cy.findByLabelText('Expand Sidebar Icon').click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add('isExpanded', {prevSubject: true}, (subject) => {
|
||||
|
||||
@@ -130,6 +130,9 @@ class RhsCardHeader extends React.PureComponent<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
const collapseIconLabel = this.props.intl.formatMessage({id: 'rhs_header.collapseSidebarTooltip.icon', defaultMessage: 'Collapse Sidebar Icon'});
|
||||
const expandIconLabel = this.props.intl.formatMessage({id: 'rhs_header.expandSidebarTooltip.icon', defaultMessage: 'Expand Sidebar Icon'});
|
||||
|
||||
return (
|
||||
<div className='sidebar--right__header'>
|
||||
<span className='sidebar--right__title'>
|
||||
@@ -146,16 +149,14 @@ class RhsCardHeader extends React.PureComponent<Props> {
|
||||
<button
|
||||
type='button'
|
||||
className='sidebar--right__expand btn btn-icon btn-sm'
|
||||
aria-label='Expand'
|
||||
aria-label={this.props.isExpanded ? collapseIconLabel : expandIconLabel}
|
||||
onClick={this.props.actions.toggleRhsExpanded}
|
||||
>
|
||||
<i
|
||||
className='icon icon-arrow-expand'
|
||||
aria-label={this.props.intl.formatMessage({id: 'rhs_header.expandSidebarTooltip.icon', defaultMessage: 'Expand Sidebar Icon'})}
|
||||
/>
|
||||
<i
|
||||
className='icon icon-arrow-collapse'
|
||||
aria-label={this.props.intl.formatMessage({id: 'rhs_header.collapseSidebarTooltip.icon', defaultMessage: 'Collapse Sidebar Icon'})}
|
||||
/>
|
||||
</button>
|
||||
</WithTooltip>
|
||||
|
||||
@@ -162,6 +162,9 @@ class RhsHeaderPost extends React.PureComponent<Props> {
|
||||
);
|
||||
}
|
||||
|
||||
const collapseIconLabel = formatMessage({id: 'rhs_header.collapseSidebarTooltip.icon', defaultMessage: 'Collapse Sidebar Icon'});
|
||||
const expandIconLabel = formatMessage({id: 'rhs_header.expandSidebarTooltip.icon', defaultMessage: 'Expand Sidebar Icon'});
|
||||
|
||||
return (
|
||||
<div className='sidebar--right__header'>
|
||||
<span className='sidebar--right__title'>
|
||||
@@ -194,16 +197,14 @@ class RhsHeaderPost extends React.PureComponent<Props> {
|
||||
<button
|
||||
type='button'
|
||||
className='sidebar--right__expand btn btn-icon btn-sm'
|
||||
aria-label='Expand'
|
||||
aria-label={this.props.isExpanded ? collapseIconLabel : expandIconLabel}
|
||||
onClick={this.props.toggleRhsExpanded}
|
||||
>
|
||||
<i
|
||||
className='icon icon-arrow-expand'
|
||||
aria-label={formatMessage({id: 'rhs_header.expandSidebarTooltip.icon', defaultMessage: 'Expand Sidebar Icon'})}
|
||||
/>
|
||||
<i
|
||||
className='icon icon-arrow-collapse'
|
||||
aria-label={formatMessage({id: 'rhs_header.collapseSidebarTooltip.icon', defaultMessage: 'Collapse Sidebar Icon'})}
|
||||
/>
|
||||
</button>
|
||||
</WithTooltip>
|
||||
|
||||
Ссылка в новой задаче
Block a user