This repository has been archived by the owner on May 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 166
[terra-form-select] - Fixed SR issues #3985
Merged
Merged
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
deadf59
Fixed SR issues
PK106552 8635737
Updated CHANGELOG file
PK106552 3f70c69
Updated CHANGELOG file
PK106552 779cc3d
Update: SR issue
MadanKumarGovindaswamy fbbca1d
Merge branch 'combobox-SR-issues' of https://github.com/cerner/terra-…
MadanKumarGovindaswamy 35a6252
Update packages/terra-form-select/CHANGELOG.md
supreethmr 52f4495
Updated review comment
PK106552 3b8ae35
Updated review comments
PK106552 c672549
Updated JEST
PK106552 17c82c0
Fixed Ability to Clear Selection example SR issue
PK106552 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ import * as KeyCode from 'keycode-js'; | |
import AddOption from '../shared/_AddOption'; | ||
import ClearOption from '../shared/_ClearOption'; | ||
import MenuUtil from '../shared/_MenuUtil'; | ||
import SharedUtil from '../shared/_SharedUtil'; | ||
import SearchResults from '../shared/_SearchResults'; | ||
import styles from '../shared/_Menu.module.scss'; | ||
import NoResults from '../shared/_NoResults'; | ||
|
@@ -104,7 +103,9 @@ class Menu extends React.Component { | |
constructor(props) { | ||
super(props); | ||
|
||
this.state = {}; | ||
this.state = { | ||
closedViaKeyEvent: false, | ||
}; | ||
|
||
this.clearScrollTimeout = this.clearScrollTimeout.bind(this); | ||
this.handleKeyDown = this.handleKeyDown.bind(this); | ||
|
@@ -177,7 +178,6 @@ class Menu extends React.Component { | |
} | ||
|
||
componentDidUpdate() { | ||
this.updateNoResultsScreenReader(); | ||
this.updateCurrentActiveScreenReader(); | ||
} | ||
|
||
|
@@ -239,8 +239,8 @@ class Menu extends React.Component { | |
results in reading the display text followed by reading the aria-live message which is | ||
the display text + 'selected' | ||
*/ | ||
if (!SharedUtil.isSafari()) { | ||
this.props.visuallyHiddenComponent.current.innerText = `${option.props.display} ${selectedTxt}`; | ||
if (option.props.value) { | ||
this.props.visuallyHiddenComponent.current.innerText = `${option.props.value} ${selectedTxt}`; | ||
} | ||
} | ||
|
||
|
@@ -299,30 +299,23 @@ class Menu extends React.Component { | |
return this.state.active === this.props.value; | ||
} | ||
|
||
updateNoResultsScreenReader() { | ||
updateNoResultsScreenReader(freeTextValue) { | ||
if (this.liveRegionTimeOut) { | ||
clearTimeout(this.liveRegionTimeOut); | ||
} | ||
|
||
this.liveRegionTimeOut = setTimeout(() => { | ||
const { hasNoResults } = this.state; | ||
|
||
const { | ||
intl, | ||
visuallyHiddenComponent, | ||
searchValue, | ||
} = this.props; | ||
|
||
// Race condition can occur between calling timeout and unmounting this component. | ||
if (!visuallyHiddenComponent || !visuallyHiddenComponent.current) { | ||
return; | ||
} | ||
|
||
if (hasNoResults) { | ||
visuallyHiddenComponent.current.innerText = intl.formatMessage({ id: 'Terra.form.select.noResults' }, { text: searchValue }); | ||
} else { | ||
visuallyHiddenComponent.current.innerText = ''; | ||
} | ||
const noMatchingResultText = intl.formatMessage({ id: 'Terra.form.select.noResults' }, { text: searchValue }); | ||
visuallyHiddenComponent.current.innerText = `${noMatchingResultText}, ${freeTextValue}`; | ||
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. Can you attach JAWS speech history as well similar to VO screenshots as a evidence 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. Thanks |
||
}, 1000); | ||
} | ||
|
||
|
@@ -334,6 +327,7 @@ class Menu extends React.Component { | |
} = this.props; | ||
|
||
const clearSelectTxt = intl.formatMessage({ id: 'Terra.form.select.clearSelect' }); | ||
const { hasNoResults } = this.state; | ||
|
||
if (this.menu !== null && this.state.active !== null) { | ||
this.menu.setAttribute('aria-activedescendant', `terra-select-option-${this.state.active}`); | ||
|
@@ -346,17 +340,21 @@ class Menu extends React.Component { | |
|
||
// Detects if option is clear option and provides accessible text | ||
if (clearOptionDisplay) { | ||
const active = this.menu.querySelector('[data-select-active]'); | ||
const active = this.menu && this.menu.querySelector('[data-select-active]'); | ||
if (active && active.hasAttribute('data-terra-select-clear-option')) { | ||
visuallyHiddenComponent.current.innerText = clearSelectTxt; | ||
} | ||
} | ||
|
||
// Detects if option is an "Add option" and provides accessible text | ||
const active = this.menu.querySelector('[data-select-active]'); | ||
const active = this.menu && this.menu.querySelector('[data-select-active]'); | ||
if (active && active.hasAttribute('data-terra-select-add-option')) { | ||
const display = active.querySelector('[data-terra-add-option]') ? active.querySelector('[data-terra-add-option]').innerText : null; | ||
visuallyHiddenComponent.current.innerText = display; | ||
if (hasNoResults && !this.state.closedViaKeyEvent) { | ||
this.updateNoResultsScreenReader(display); | ||
} else { | ||
visuallyHiddenComponent.current.innerText = display; | ||
} | ||
} | ||
|
||
const optGroupElement = MenuUtil.getOptGroupElement(this.props.children, this.state.active); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you provide link of code line where we are changing the value of this state from its initial value
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.
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.
terra-core/packages/terra-form-select/src/combobox/Menu.jsx
Line 221 in 35a6252