[MM-61587]: Added appropriate ARIA attributes in the channel header (#29563)

* [MA-8]: Added appropriate ARIA attributes in the channel header

* [MA-8]: Review Fixes: Updated the aria-expanded ternary condition

* [MA-8]: Rebased with master and fixed e2e failing test

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
ayush-chauhan233
2025-01-16 03:54:24 +05:30
коммит произвёл GitHub
родитель c3ff2c5129
Коммит 5c08e0de0b
3 изменённых файлов: 29 добавлений и 27 удалений

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

@@ -90,7 +90,7 @@ describe('channels > rhs > header', {testIsolation: true}, () => {
cy.get('#rhsContainer').findByTestId('rendered-run-name').should('be.visible').contains('new run name');
// * make sure the channel name remains unchanged
cy.get('#channelHeaderInfo').contains(playbookRunName);
cy.get('#channelHeaderInfo').findByRole('heading').contains(playbookRunName);
});
});

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

@@ -103,6 +103,8 @@ const ChannelHeaderTitle = ({
size='sm'
/>
<strong
role='heading'
aria-level={2}
id='channelHeaderTitle'
className='heading'
>
@@ -130,44 +132,43 @@ const ChannelHeaderTitle = ({
<div
id='channelHeaderDropdownButton'
>
<button
className={classNames('channel-header__trigger style--none', {active: titleMenuOpen})}
aria-label={intl.formatMessage({id: 'channel_header.menuAriaLabel', defaultMessage: 'Channel Menu'}).toLowerCase()}
<strong
role='heading'
aria-level={2}
id='channelHeaderTitle'
className='heading'
ref={headerItemRef}
>
{showTooltip ? (
<WithTooltip
title={channelTitle as string}
>
<strong
id='channelHeaderTitle'
className='heading'
ref={headerItemRef}
<button
id='channel_header.menuAriaLabel'
className={classNames('channel-header__trigger style--none', {active: titleMenuOpen})}
aria-label={intl.formatMessage({id: 'channel_header.menuAriaLabel', defaultMessage: 'Channel Menu'}).toLowerCase()}
aria-expanded={titleMenuOpen}
aria-controls='channelHeaderDropdownMenu'
>
{showTooltip ? (
<WithTooltip
title={channelTitle as string}
>
<span>
{archivedIcon}
{channelTitle}
{sharedIcon}
</span>
</strong>
</WithTooltip>
) : (
<strong
id='channelHeaderTitle'
className='heading'
ref={headerItemRef}
>
</WithTooltip>
) : (
<span>
{archivedIcon}
{channelTitle}
{sharedIcon}
</span>
</strong>
)}
<span
id='channelHeaderDropdownIcon'
className='icon icon-chevron-down header-dropdown-chevron-icon'
/>
</button>
)}
<span
id='channelHeaderDropdownIcon'
className='icon icon-chevron-down header-dropdown-chevron-icon'
/>
</button>
</strong>
</div>
<ChannelHeaderDropdown/>
</MenuWrapper>

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

@@ -209,6 +209,7 @@
.heading {
overflow: hidden;
align-self: center;
padding: 4px;
margin: 0 0 0 2px;
color: var(--center-channel-color);
font-family: Metropolis, sans-serif;