[MM-61591]: Fixed the dialog aria-properties in profile popover (#29593)
* [MA-10]: Fixed the dialog aria-properties in profile popover * [MA-10]: Updated the logic to add aria-label to profile popover * [MA-10]: Updated the aria-label to be translatable * [MA-10]:Updated the dialog aria-properties in profile popover * [MA-10]: Fixed the dialog aria-properties in profile popover * [MA-10]: Updated the translation string
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f6a2f00fdb
Коммит
0cca57b6df
@@ -42,6 +42,7 @@ exports[`components/drafts/panel/panel_body should have called handleFormattedTe
|
|||||||
src="/api/v4/users/user_id/image?_=0"
|
src="/api/v4/users/user_id/image?_=0"
|
||||||
triggerComponentClass="status-wrapper"
|
triggerComponentClass="status-wrapper"
|
||||||
userId="user_id"
|
userId="user_id"
|
||||||
|
username="username"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -268,6 +269,7 @@ exports[`components/drafts/panel/panel_body should match snapshot 1`] = `
|
|||||||
src="/api/v4/users/user_id/image?_=0"
|
src="/api/v4/users/user_id/image?_=0"
|
||||||
triggerComponentClass="status-wrapper"
|
triggerComponentClass="status-wrapper"
|
||||||
userId="user_id"
|
userId="user_id"
|
||||||
|
username="username"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -500,6 +502,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for priority 1
|
|||||||
src="/api/v4/users/user_id/image?_=0"
|
src="/api/v4/users/user_id/image?_=0"
|
||||||
triggerComponentClass="status-wrapper"
|
triggerComponentClass="status-wrapper"
|
||||||
userId="user_id"
|
userId="user_id"
|
||||||
|
username="username"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
@@ -789,6 +792,7 @@ exports[`components/drafts/panel/panel_body should match snapshot for requested_
|
|||||||
src="/api/v4/users/user_id/image?_=0"
|
src="/api/v4/users/user_id/image?_=0"
|
||||||
triggerComponentClass="status-wrapper"
|
triggerComponentClass="status-wrapper"
|
||||||
userId="user_id"
|
userId="user_id"
|
||||||
|
username="username"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ function ProfilePicture(props: Props) {
|
|||||||
triggerComponentClass={classNames('status-wrapper', props.wrapperClass)}
|
triggerComponentClass={classNames('status-wrapper', props.wrapperClass)}
|
||||||
userId={props.userId}
|
userId={props.userId}
|
||||||
src={profileSrc}
|
src={profileSrc}
|
||||||
|
username={props.username}
|
||||||
channelId={props.channelId}
|
channelId={props.channelId}
|
||||||
hideStatus={hideStatus}
|
hideStatus={hideStatus}
|
||||||
overwriteIcon={props.overwriteIcon}
|
overwriteIcon={props.overwriteIcon}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import {
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import type {HtmlHTMLAttributes, ReactNode} from 'react';
|
import type {HtmlHTMLAttributes, ReactNode} from 'react';
|
||||||
import React, {useCallback, useState} from 'react';
|
import React, {useCallback, useState} from 'react';
|
||||||
|
import {useIntl} from 'react-intl';
|
||||||
|
|
||||||
import type {Channel} from '@mattermost/types/channels';
|
import type {Channel} from '@mattermost/types/channels';
|
||||||
import type {UserProfile} from '@mattermost/types/users';
|
import type {UserProfile} from '@mattermost/types/users';
|
||||||
@@ -41,6 +42,11 @@ interface Props<TriggerComponentType> {
|
|||||||
*/
|
*/
|
||||||
src: string;
|
src: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Username of the profile.
|
||||||
|
*/
|
||||||
|
username?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This should be the trigger button for the popover, Do note that the root element of the trigger component should be passed in triggerComponentRoot
|
* This should be the trigger button for the popover, Do note that the root element of the trigger component should be passed in triggerComponentRoot
|
||||||
*/
|
*/
|
||||||
@@ -77,6 +83,17 @@ interface Props<TriggerComponentType> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function ProfilePopoverController<TriggerComponentType = HTMLSpanElement>(props: Props<TriggerComponentType>) {
|
export function ProfilePopoverController<TriggerComponentType = HTMLSpanElement>(props: Props<TriggerComponentType>) {
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
|
const profileAriaLabel = intl.formatMessage({id: 'profile_popover.aria_label.without_username', defaultMessage: 'profile popover'});
|
||||||
|
const userProfileAriaLabel = intl.formatMessage({
|
||||||
|
id: 'profile_popover.aria_label.with_username',
|
||||||
|
defaultMessage: '{userName}\'s profile popover',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userName: props.username,
|
||||||
|
});
|
||||||
|
|
||||||
const [isOpen, setOpen] = useState(false);
|
const [isOpen, setOpen] = useState(false);
|
||||||
|
|
||||||
const {refs, floatingStyles, context: floatingContext} = useFloating({
|
const {refs, floatingStyles, context: floatingContext} = useFloating({
|
||||||
@@ -127,6 +144,7 @@ export function ProfilePopoverController<TriggerComponentType = HTMLSpanElement>
|
|||||||
ref={refs.setFloating}
|
ref={refs.setFloating}
|
||||||
style={{...floatingStyles, ...transitionStyles}}
|
style={{...floatingStyles, ...transitionStyles}}
|
||||||
className={classNames('user-profile-popover', A11yClassNames.POPUP)}
|
className={classNames('user-profile-popover', A11yClassNames.POPUP)}
|
||||||
|
aria-label={props.username ? userProfileAriaLabel : profileAriaLabel}
|
||||||
{...getFloatingProps()}
|
{...getFloatingProps()}
|
||||||
>
|
>
|
||||||
<ProfilePopover
|
<ProfilePopover
|
||||||
|
|||||||
@@ -4809,6 +4809,8 @@
|
|||||||
"pricing_modal.title": "Select a plan",
|
"pricing_modal.title": "Select a plan",
|
||||||
"pricing_modal.wantToTry": "Want to try? ",
|
"pricing_modal.wantToTry": "Want to try? ",
|
||||||
"pricing_modal.wantToUpgrade": "Want to upgrade? ",
|
"pricing_modal.wantToUpgrade": "Want to upgrade? ",
|
||||||
|
"profile_popover.aria_label.with_username": "{userName}'s profile popover",
|
||||||
|
"profile_popover.aria_label.without_username": "profile popover",
|
||||||
"promote_to_user_modal.desc": "This action promotes the guest {username} to a member. It will allow the user to join public channels and interact with users outside of the channels they are currently members of. Are you sure you want to promote guest {username} to member?",
|
"promote_to_user_modal.desc": "This action promotes the guest {username} to a member. It will allow the user to join public channels and interact with users outside of the channels they are currently members of. Are you sure you want to promote guest {username} to member?",
|
||||||
"promote_to_user_modal.promote": "Promote",
|
"promote_to_user_modal.promote": "Promote",
|
||||||
"promote_to_user_modal.title": "Promote guest {username} to member",
|
"promote_to_user_modal.title": "Promote guest {username} to member",
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user