Skip to content

Commit 154b845

Browse files
committed
fix issues where textarea was repeating
1 parent a812562 commit 154b845

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

__tests__/html2/feedbackForm/feedback.form.activity.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@
8585
const feedbackFormSendBox = pageElements.byTestId('feedback sendbox');
8686
const ariaLabelledBy = feedbackFormSendBox.getAttribute('aria-labelledby');
8787
expect(ariaLabelledBy).toContain('feedback-form__form-header__id');
88-
expect(ariaLabelledBy).toContain('feedback-form__form-footer__id');
89-
expect(ariaLabelledBy).toContain('feedback-form__text-area__id');
88+
const ariaDescribedBy = feedbackFormSendBox.getAttribute('aria-describedby');
89+
expect(ariaDescribedBy).toContain('feedback-form__disclaimer__id');
9090
await pageObjects.verifyDOMIntegrity();
9191

9292
// WHEN: The cancel button is clicked.

packages/component/src/ActivityFeedback/private/FeedbackForm.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function FeedbackForm() {
1717
const { useFeedbackText, useSelectedAction } = useActivityFeedbackHooks();
1818
const feedbackFormHeaderId = useUniqueId('feedback-form__form-header__id');
1919
const disclaimerId = useUniqueId('feedback-form__form-footer__id');
20-
const textAreaId = useUniqueId('feedback-form__text-area__id');
2120

2221
const [selectedAction] = useSelectedAction();
2322
const [hasFocus, setHasFocus] = useState(false);
@@ -43,8 +42,6 @@ function FeedbackForm() {
4342
}
4443
}, [feedbackTextAreaRef, hasFocus, setHasFocus]);
4544

46-
const textAreaAriaLabelledBy = `${feedbackFormHeaderId} ${textAreaId}${disclaimer ? ` ${disclaimerId}` : ''}`;
47-
4845
return (
4946
<div className={classNames['feedback-form__form']}>
5047
<span
@@ -57,11 +54,10 @@ function FeedbackForm() {
5754
</span>
5855
<div className={classNames['feedback-form__text-box']}>
5956
<TextArea
60-
aria-label={localize('FEEDBACK_FORM_PLACEHOLDER')}
61-
aria-labelledby={textAreaAriaLabelledBy}
57+
aria-describedby={disclaimer ? disclaimerId : undefined}
58+
aria-labelledby={feedbackFormHeaderId}
6259
className={classNames['feedback-form__text-area']}
6360
data-testid={testIds.feedbackSendBox}
64-
id={textAreaId}
6561
onInput={handleMessageChange}
6662
placeholder={localize('FEEDBACK_FORM_PLACEHOLDER')}
6763
ref={feedbackTextAreaRef}

packages/component/src/TextArea/TextArea.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const { useUIState } = hooks;
1818
const TextArea = forwardRef<
1919
HTMLTextAreaElement,
2020
Readonly<{
21-
'aria-label'?: string | undefined;
21+
'aria-describedby'?: string | undefined;
2222
'aria-labelledby'?: string | undefined;
2323
className?: string | undefined;
2424
completion?: ReactNode | undefined;
@@ -33,7 +33,6 @@ const TextArea = forwardRef<
3333
* This ensures the flow of focus did not sent to document body
3434
*/
3535
hidden?: boolean | undefined;
36-
id?: string | undefined;
3736
onInput?: FormEventHandler<HTMLTextAreaElement> | undefined;
3837
placeholder?: string | undefined;
3938
startRows?: number | undefined;
@@ -85,14 +84,11 @@ const TextArea = forwardRef<
8584
{props.completion ? props.completion : props.value || props.placeholder}{' '}
8685
</div>
8786
<textarea
87+
aria-describedby={props['aria-describedby']}
8888
aria-disabled={disabled}
89-
aria-label={props['aria-label']}
9089
aria-labelledby={props['aria-labelledby']}
9190
className={cx(classNames['text-area-input'], classNames['text-area-shared'])}
9291
data-testid={props['data-testid']}
93-
// "id" is required for "aria-labelledby"
94-
// eslint-disable-next-line react/forbid-dom-props
95-
id={props['id']}
9692
onCompositionEnd={handleCompositionEnd}
9793
onCompositionStart={handleCompositionStart}
9894
onInput={props.onInput}

0 commit comments

Comments
 (0)