[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
Этот коммит содержится в:
Saurabh Sharma
2025-01-17 02:33:34 +05:30
коммит произвёл GitHub
родитель bf541446cf
Коммит 2d61d13940
4 изменённых файлов: 10 добавлений и 12 удалений

Просмотреть файл

@@ -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>