-
Notifications
You must be signed in to change notification settings - Fork 166
[Terra-SearchSelect]SR doesn't announce the placeholder when the input field gains focus. #3984
Changes from 15 commits
674fcdc
8e7621a
c0e4c12
6e9d248
bbd4891
6762150
91435b4
645bd70
8afddb4
5d1891e
0cf569a
eb3c2b0
f941cfe
42d8b2c
f0231ab
b5951b0
c2b4b01
b86c09b
e8fddbd
5497751
5891c74
2069857
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,9 @@ | |
|
||
## Unreleased | ||
|
||
* Added | ||
* Added Chrome-specific condition to announce the placeholder. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it still chrome specific condition There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
## 6.51.0 - (November 21, 2023) | ||
|
||
* Added | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -510,18 +510,23 @@ class Frame extends React.Component { | |||||||||||||
* Falls back to the string 'Search' if no label is provided | ||||||||||||||
*/ | ||||||||||||||
ariaLabel() { | ||||||||||||||
const { ariaLabel, disabled, intl } = this.props; | ||||||||||||||
const { | ||||||||||||||
ariaLabel, disabled, intl, placeholder, | ||||||||||||||
} = this.props; | ||||||||||||||
|
||||||||||||||
const defaultAriaLabel = intl.formatMessage({ id: 'Terra.form.select.ariaLabel' }); | ||||||||||||||
const dimmed = intl.formatMessage({ id: 'Terra.form.select.dimmed' }); | ||||||||||||||
|
||||||||||||||
// VO on iOS doesn't do a good job of announcing disabled stated. Here we append the phrase that | ||||||||||||||
// VO associates with disabled form controls. | ||||||||||||||
if ('ontouchstart' in window && disabled) { | ||||||||||||||
return ariaLabel === undefined ? `${defaultAriaLabel} ${dimmed}` : `${ariaLabel} ${dimmed}`; | ||||||||||||||
return ariaLabel === undefined | ||||||||||||||
? `${defaultAriaLabel} ${placeholder} ${dimmed}` | ||||||||||||||
: `${ariaLabel} ${placeholder} ${dimmed}`; | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
return ariaLabel === undefined ? defaultAriaLabel : ariaLabel; | ||||||||||||||
return ariaLabel === undefined | ||||||||||||||
? `${defaultAriaLabel} ${placeholder}` | ||||||||||||||
: `${ariaLabel} ${placeholder}`; | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||||||||||||||
} | ||||||||||||||
|
||||||||||||||
/** | ||||||||||||||
|
@@ -654,7 +659,6 @@ class Frame extends React.Component { | |||||||||||||
customProps.className, | ||||||||||||||
); | ||||||||||||||
|
||||||||||||||
const labelId = `terra-select-screen-reader-label-${uniqueid()}`; | ||||||||||||||
const descriptionId = `terra-select-screen-reader-description-${uniqueid()}`; | ||||||||||||||
const customAriaDescribedbyIds = customProps['aria-describedby']; | ||||||||||||||
const ariaDescribedBy = customAriaDescribedbyIds ? `${descriptionId} ${customAriaDescribedbyIds}` : descriptionId; | ||||||||||||||
|
@@ -692,8 +696,6 @@ class Frame extends React.Component { | |||||||||||||
ref={(select) => { this.select = select; }} | ||||||||||||||
> | ||||||||||||||
<div className={cx('visually-hidden-component')} hidden> | ||||||||||||||
{/* Hidden attribute used to prevent VoiceOver on desktop from announcing this content twice */} | ||||||||||||||
<span id={labelId}>{this.ariaLabel()}</span> | ||||||||||||||
<span id={descriptionId}>{this.renderDescriptionText()}</span> | ||||||||||||||
</div> | ||||||||||||||
<div className={cx('display')}> | ||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,12 +195,7 @@ exports[`Frame correctly applies the theme context className for search variant | |
hidden="" | ||
> | ||
<span | ||
id="terra-select-screen-reader-label-13" | ||
> | ||
Terra.form.select.ariaLabel | ||
</span> | ||
<span | ||
id="terra-select-screen-reader-description-14" | ||
id="terra-select-screen-reader-description-13" | ||
> | ||
Terra.form.select.listOfTotalOptions Terra.form.select.searchUsageGuidance | ||
</span> | ||
|
@@ -212,11 +207,11 @@ exports[`Frame correctly applies the theme context className for search variant | |
class="content" | ||
> | ||
<input | ||
aria-describedby="terra-select-screen-reader-description-14" | ||
aria-describedby="terra-select-screen-reader-description-13" | ||
aria-disabled="false" | ||
aria-expanded="false" | ||
aria-invalid="false" | ||
aria-label="Terra.form.select.ariaLabel" | ||
aria-label="Terra.form.select.ariaLabel undefined" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. undefined should not be part of Aria-label There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Modified. |
||
aria-required="false" | ||
class="search-input" | ||
role="combobox" | ||
|
@@ -243,7 +238,7 @@ exports[`Frame correctly applies the theme context className for search variant | |
|
||
exports[`Frame correctly applies the theme context className for tag variant 1`] = ` | ||
<div | ||
aria-describedby="terra-select-screen-reader-description-18" | ||
aria-describedby="terra-select-screen-reader-description-17" | ||
aria-disabled="false" | ||
aria-expanded="false" | ||
aria-haspopup="true" | ||
|
@@ -257,12 +252,12 @@ exports[`Frame correctly applies the theme context className for tag variant 1`] | |
hidden="" | ||
> | ||
<span | ||
id="terra-select-screen-reader-label-16" | ||
id="terra-select-screen-reader-label-15" | ||
> | ||
Terra.form.select.ariaLabel | ||
</span> | ||
<span | ||
id="terra-select-screen-reader-description-18" | ||
id="terra-select-screen-reader-description-17" | ||
> | ||
Terra.form.select.listOfTotalOptions Terra.form.select.multiSelectUsageGuidance | ||
</span> | ||
|
@@ -278,7 +273,7 @@ exports[`Frame correctly applies the theme context className for tag variant 1`] | |
class="search-wrapper" | ||
> | ||
<input | ||
aria-describedby="terra-select-screen-reader-display-17 terra-select-screen-reader-description-18" | ||
aria-describedby="terra-select-screen-reader-display-16 terra-select-screen-reader-description-17" | ||
aria-disabled="false" | ||
aria-label="Terra.form.select.ariaLabel" | ||
aria-required="false" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this code updates
Colors
in two places, one at input control asaria-label
prop and another at added for label values Since input has got role ascombobox
I think aria-label should be sufficient for all both VO and JAWS .I think we can remove the label span and keep the prop
aria-label
on form-search-select.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed as we are passing aria-label.