Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(web,input) Added description to inputs that filter participants

raduanastase8x8affef1ac66da
diff --git a/lang/main.json b/lang/main.json
index 264f0907fa..5b2bf867ae 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -881,6 +881,7 @@
"waitingLobby": "Waiting in lobby ({{count}})"
},
"search": "Search participants",
+ "searchDescription": "Start typing to filter participants",
"title": "Participants"
},
"passwordDigitsOnly": "Up to {{number}} digits",
@@ -1197,6 +1198,7 @@
"neutral": "Neutral",
"sad": "Sad",
"search": "Search",
+ "searchDescription": "Start typing to filter participants",
"searchHint": "Search participants",
"seconds": "{{count}}s",
"speakerStats": "Participants Stats",
diff --git a/react/features/base/ui/components/web/HiddenDescription.tsx b/react/features/base/ui/components/web/HiddenDescription.tsx
new file mode 100644
index 0000000000..54f86184bb
--- /dev/null
+++ b/react/features/base/ui/components/web/HiddenDescription.tsx
@@ -0,0 +1,29 @@
+import React from 'react';
+
+interface IHiddenDescriptionProps {
+ children: React.ReactNode;
+ id: string;
+}
+
+export const HiddenDescription: React.FC<IHiddenDescriptionProps> = ({ id, children }) => {
+ const hiddenStyle: React.CSSProperties = {
+ border: 0,
+ clip: 'rect(0 0 0 0)',
+ clipPath: 'inset(50%)',
+ height: '1px',
+ margin: '-1px',
+ overflow: 'hidden',
+ padding: 0,
+ position: 'absolute',
+ width: '1px',
+ whiteSpace: 'nowrap'
+ };
+
+ return (
+ <span
+ id = { id }
+ style = { hiddenStyle }>
+ {children}
+ </span>
+ );
+};
diff --git a/react/features/base/ui/components/web/Input.tsx b/react/features/base/ui/components/web/Input.tsx
index 5613048de0..142dd4b855 100644
--- a/react/features/base/ui/components/web/Input.tsx
+++ b/react/features/base/ui/components/web/Input.tsx
@@ -7,6 +7,7 @@ import Icon from '../../../icons/components/Icon';
import { IconCloseCircle } from '../../../icons/svg';
import { withPixelLineHeight } from '../../../styles/functions.web';
import { IInputProps } from '../types';
+import { HiddenDescription } from './HiddenDescription';
interface IProps extends IInputProps {
accessibilityLabel?: string;
@@ -14,6 +15,7 @@ interface IProps extends IInputProps {
autoFocus?: boolean;
bottomLabel?: string;
className?: string;
+ hiddenDescription?: string; // Text that will be announced by screen readers but not displayed visually.
iconClick?: () => void;
/**
@@ -159,6 +161,7 @@ const Input = React.forwardRef<any, IProps>(({
clearable = false,
disabled,
error,
+ hiddenDescription,
icon,
iconClick,
id,
@@ -190,6 +193,16 @@ const Input = React.forwardRef<any, IProps>(({
onChange?.(e.target.value), []);
const clearInput = useCallback(() => onChange?.(''), []);
+ const hiddenDescriptionId = `${id}-hidden-description`;
+ let ariaDescribedById: string | undefined;
+
+ if (bottomLabel) {
+ ariaDescribedById = `${id}-description`;
+ } else if (hiddenDescription) {
+ ariaDescribedById = hiddenDescriptionId;
+ } else {
+ ariaDescribedById = undefined;
+ }
return (
<div className = { cx(styles.inputContainer, className) }>
@@ -207,6 +220,7 @@ const Input = React.forwardRef<any, IProps>(({
src = { icon } />}
{textarea ? (
<TextareaAutosize
+ aria-describedby = { ariaDescribedById }
aria-label = { accessibilityLabel }
autoComplete = { autoComplete }
autoFocus = { autoFocus }
@@ -227,7 +241,7 @@ const Input = React.forwardRef<any, IProps>(({
value = { value } />
) : (
<input
- aria-describedby = { bottomLabel ? `${id}-description` : undefined }
+ aria-describedby = { ariaDescribedById }
aria-label = { accessibilityLabel }
autoComplete = { autoComplete }
autoFocus = { autoFocus }
@@ -266,6 +280,7 @@ const Input = React.forwardRef<any, IProps>(({
{bottomLabel}
</span>
)}
+ {!bottomLabel && hiddenDescription && <HiddenDescription id = { hiddenDescriptionId }>{ hiddenDescription }</HiddenDescription>}
</div>
);
});
diff --git a/react/features/participants-pane/components/web/MeetingParticipants.tsx b/react/features/participants-pane/components/web/MeetingParticipants.tsx
index 5022b32486..507a622a0c 100644
--- a/react/features/participants-pane/components/web/MeetingParticipants.tsx
+++ b/react/features/participants-pane/components/web/MeetingParticipants.tsx
@@ -130,6 +130,7 @@ function MeetingParticipants({
accessibilityLabel = { t('participantsPane.search') }
className = { styles.search }
clearable = { true }
+ hiddenDescription = { t('participantsPane.searchDescription') }
id = 'participants-search-input'
onChange = { setSearchString }
placeholder = { t('participantsPane.search') }
diff --git a/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx b/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx
index 7f1ab42bb2..3192c63804 100644
--- a/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx
+++ b/react/features/speaker-stats/components/web/SpeakerStatsSearch.tsx
@@ -9,6 +9,7 @@ import { getFieldValue } from '../../../base/react/functions';
import { withPixelLineHeight } from '../../../base/styles/functions.web';
import { MOBILE_BREAKPOINT } from '../../constants';
import { isSpeakerStatsSearchDisabled } from '../../functions';
+import { HiddenDescription } from '../../../base/ui/components/web/HiddenDescription';
const useStyles = makeStyles()(theme => {
return {
@@ -96,6 +97,9 @@ function SpeakerStatsSearch({ onSearch }: IProps) {
return null;
}
+ const inputId = 'speaker-stats-search';
+ const inputDescriptionId = `${inputId}-hidden-description`;
+
return (
<div className = { classes.speakerStatsSearchContainer }>
<Icon
@@ -103,17 +107,21 @@ function SpeakerStatsSearch({ onSearch }: IProps) {
color = { theme.palette.icon03 }
src = { IconSearch } />
<input
+ aria-describedby = { inputDescriptionId }
aria-label = { t('speakerStats.searchHint') }
autoComplete = 'off'
autoFocus = { false }
className = { classes.speakerStatsSearch }
- id = 'speaker-stats-search'
+ id = { inputId }
name = 'speakerStatsSearch'
onChange = { onChange }
onKeyPress = { preventDismiss }
placeholder = { t('speakerStats.search') }
tabIndex = { 0 }
value = { searchValue } />
+ <HiddenDescription id = { inputDescriptionId }>
+ {t('speakerStats.searchDescription')}
+ </HiddenDescription>
</div>
);
}