A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
chore: Some accessibility improvements.
haitaoo0d746cb3fb02
diff --git a/i18n/en_US.yaml b/i18n/en_US.yamlindex 7ca9c6fa..ea0f3985 100644--- a/i18n/en_US.yaml+++ b/i18n/en_US.yaml@@ -504,6 +504,7 @@ ui:title: Notificationsinbox: Inboxachievement: Achievements+ new_alerts: New alertsall_read: Mark all as readshow_more: Show moresomeone: Someone@@ -729,7 +730,7 @@ ui:tip_answer: >-Use comments to reply to other users or notify them of changes. If you areadding new information, edit your post instead of commenting.- tip_vote: It adds something useful to the post+ tip_vote: It is usefuledit_answer:title: Edit Answerdefault_reason: Edit answer@@ -940,7 +941,6 @@ ui:gravatar: Gravatargravatar_text: You can change image oncustom: Custom- btn_refresh: Refreshcustom_text: You can upload your image.default: Systemmsg: Please upload an avatar@@ -1025,6 +1025,7 @@ ui:useful: Usefulquestion_useful: It is useful and clearquestion_un_useful: It is unclear or not useful+ question_bookmark: Bookmark this questionanswer_useful: It is usefulanswer_un_useful: It is not usefulanswers:@@ -1092,6 +1093,7 @@ ui:question: Questionanswer: Answercomment: Comment+ refresh: Refreshsearch:title: Search Resultskeywords: Keywordsdiff --git a/ui/src/components/Actions/index.tsx b/ui/src/components/Actions/index.tsxindex 268ff9d1..554f57c3 100644--- a/ui/src/components/Actions/index.tsx+++ b/ui/src/components/Actions/index.tsx@@ -131,6 +131,7 @@ const Index: FC<Props> = ({ className, data, source }) => {{!data?.hideCollect && (<Buttonvariant="outline-secondary ms-3"+ title={t('question_detail.question_bookmark')}active={bookmarkState.state}onClick={handleBookmark}><Icon name="bookmark-fill" />diff --git a/ui/src/components/Avatar/index.tsx b/ui/src/components/Avatar/index.tsxindex 79d73970..e620637d 100644--- a/ui/src/components/Avatar/index.tsx+++ b/ui/src/components/Avatar/index.tsx@@ -11,9 +11,16 @@ interface IProps {size: string;searchStr?: string;className?: string;+ alt?: string;}-const Index: FC<IProps> = ({ avatar, size, className, searchStr = '' }) => {+const Index: FC<IProps> = ({+ avatar,+ size,+ className,+ searchStr = '',+ alt,+}) => {let url = '';if (typeof avatar === 'string') {if (avatar.length > 1) {@@ -31,13 +38,17 @@ const Index: FC<IProps> = ({ avatar, size, className, searchStr = '' }) => {className && className.indexOf('rounded') !== -1 ? '' : 'rounded';return (- <img- src={url || DefaultAvatar}- width={size}- height={size}- className={classNames(roundedCls, className)}- alt=""- />+ <>+ {/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role,jsx-a11y/control-has-associated-label */}+ <img+ role="button"+ src={url || DefaultAvatar}+ width={size}+ height={size}+ className={classNames(roundedCls, className)}+ alt={alt}+ />+ </>);};diff --git a/ui/src/components/Header/components/NavItems/index.tsx b/ui/src/components/Header/components/NavItems/index.tsxindex 17514a9f..d9ccd553 100644--- a/ui/src/components/Header/components/NavItems/index.tsx+++ b/ui/src/components/Header/components/NavItems/index.tsx@@ -10,7 +10,7 @@ import { userCenterStore } from '@/stores';interface Props {redDot: Type.NotificationStatus | undefined;- userInfo;+ userInfo: Type.UserInfoRes;logOut: () => void;}@@ -32,18 +32,30 @@ const Index: FC<Props> = ({ redDot, userInfo, logOut }) => {<Nav.Linkas={NavLink}to="/users/notifications/inbox"+ title={t('inbox', { keyPrefix: 'notifications' })}className="icon-link d-flex align-items-center justify-content-center p-0 me-3 position-relative"><Icon name="bell-fill" className="fs-4" />- {(redDot?.inbox || 0) > 0 && <div className="unread-dot bg-danger" />}+ {(redDot?.inbox || 0) > 0 && (+ <div className="unread-dot bg-danger">+ <span className="visually-hidden">+ {t('new_alerts', { keyPrefix: 'notifications' })}+ </span>+ </div>+ )}</Nav.Link><Nav.Linkas={NavLink}to="/users/notifications/achievement"+ title={t('achievement', { keyPrefix: 'notifications' })}className="icon-link d-flex align-items-center justify-content-center p-0 me-3 position-relative"><Icon name="trophy-fill" className="fs-4" />{(redDot?.achievement || 0) > 0 && (- <div className="unread-dot bg-danger" />+ <div className="unread-dot bg-danger">+ <span className="visually-hidden">+ {t('new_alerts', { keyPrefix: 'notifications' })}+ </span>+ </div>)}</Nav.Link></Nav>@@ -54,7 +66,12 @@ const Index: FC<Props> = ({ redDot, userInfo, logOut }) => {id="dropdown-basic"as="a"className="no-toggle pointer">- <Avatar size="36px" avatar={userInfo?.avatar} searchStr="s=96" />+ <Avatar+ size="36px"+ avatar={userInfo?.avatar}+ alt={userInfo?.display_name}+ searchStr="s=96"+ /></Dropdown.Toggle><Dropdown.Menu>diff --git a/ui/src/components/Header/index.tsx b/ui/src/components/Header/index.tsxindex 5399abbf..bb69f7ae 100644--- a/ui/src/components/Header/index.tsx+++ b/ui/src/components/Header/index.tsx@@ -45,7 +45,7 @@ const Header: FC = () => {const siteInfo = siteInfoStore((state) => state.siteInfo);const brandingInfo = brandingStore((state) => state.branding);const loginSetting = loginSettingStore((state) => state.login);- const { updateReiview, updateVisible } = sideNavStore();+ const { updateReview, updateVisible } = sideNavStore();const { data: redDot } = useQueryNotificationStatus();/*** Automatically append `tag` information when creating a question@@ -57,7 +57,7 @@ const Header: FC = () => {}useEffect(() => {- updateReiview({+ updateReview({can_revision: Boolean(redDot?.can_revision),revision: Number(redDot?.revision),});diff --git a/ui/src/components/Icon/index.tsx b/ui/src/components/Icon/index.tsxindex ba973873..370bdd7f 100644--- a/ui/src/components/Icon/index.tsx+++ b/ui/src/components/Icon/index.tsx@@ -17,7 +17,7 @@ const Icon: FC<IProps> = ({className,size,onClick,- title = '',+ title,}) => {return (<idiff --git a/ui/src/components/Modal/PicAuthCodeModal.tsx b/ui/src/components/Modal/PicAuthCodeModal.tsxindex a4ff6acc..5b40423d 100644--- a/ui/src/components/Modal/PicAuthCodeModal.tsx+++ b/ui/src/components/Modal/PicAuthCodeModal.tsx@@ -73,6 +73,7 @@ const Index: React.FC<IProps> = ({<ButtononClick={refreshImgCode}variant="outline-secondary"+ title={t('refresh', { keyPrefix: 'btns' })}style={{borderTopRightRadius: '0.375rem',borderBottomRightRadius: '0.375rem',diff --git a/ui/src/index.tsx b/ui/src/index.tsxindex 71133668..c7d460b9 100644--- a/ui/src/index.tsx+++ b/ui/src/index.tsx@@ -22,7 +22,9 @@ document.addEventListener(}if (/IMG/.test(target.nodeName)) {- target.classList.add('invisible');+ if (!target.getAttribute('alt')) {+ target.classList.add('invisible');+ }}},true,diff --git a/ui/src/pages/Admin/Plugins/Installed/index.tsx b/ui/src/pages/Admin/Plugins/Installed/index.tsxindex f0a03031..cde0cb1b 100644--- a/ui/src/pages/Admin/Plugins/Installed/index.tsx+++ b/ui/src/pages/Admin/Plugins/Installed/index.tsx@@ -112,7 +112,7 @@ const Users: FC = () => {<td className="text-end"><Dropdown><Dropdown.Toggle variant="link" className="no-toggle">- <Icon name="three-dots-vertical" />+ <Icon name="three-dots-vertical" title={t('action')} /></Dropdown.Toggle><Dropdown.Menu>{plugin.enabled ? (diff --git a/ui/src/pages/Admin/Users/index.tsx b/ui/src/pages/Admin/Users/index.tsxindex 1c1b8fc1..e981a882 100644--- a/ui/src/pages/Admin/Users/index.tsx+++ b/ui/src/pages/Admin/Users/index.tsx@@ -270,7 +270,7 @@ const Users: FC = () => {<td className="text-end"><Dropdown><Dropdown.Toggle variant="link" className="no-toggle">- <Icon name="three-dots-vertical" />+ <Icon name="three-dots-vertical" title={t('action')} /></Dropdown.Toggle><Dropdown.Menu>{showActionPassword ? (diff --git a/ui/src/pages/Questions/Detail/components/Answer/index.tsx b/ui/src/pages/Questions/Detail/components/Answer/index.tsxindex 2024d6f9..26777cbb 100644--- a/ui/src/pages/Questions/Detail/components/Answer/index.tsx+++ b/ui/src/pages/Questions/Detail/components/Answer/index.tsx@@ -67,9 +67,11 @@ const Index: FC<Props> = ({}, 100);}}, [data.id, answerRef.current]);+if (!data?.id) {return null;}+return (<div id={data.id} ref={answerRef} className="answer-item py-4">{data.status === 10 && (diff --git a/ui/src/stores/sideNav.ts b/ui/src/stores/sideNav.tsindex 3f9a2f13..f6be3387 100644--- a/ui/src/stores/sideNav.ts+++ b/ui/src/stores/sideNav.ts@@ -10,7 +10,7 @@ interface ErrorCodeType {can_revision: boolean;revision: number;updateVisible: () => void;- updateReiview: (params: reviewData) => void;+ updateReview: (params: reviewData) => void;}const Index = create<ErrorCodeType>((set) => ({@@ -22,7 +22,7 @@ const Index = create<ErrorCodeType>((set) => ({return { visible: !state.visible };});},- updateReiview: (params: reviewData) => {+ updateReview: (params: reviewData) => {set(() => {return { ...params };});