-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fixes duplicate reading of suggestions on people picker #4765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2797c1d
451279a
d88c280
083aacf
11d1f3c
44d046a
18e8c63
06d9391
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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "office-ui-fabric-react", | ||
| "comment": "Puts additional alert on selected suggestions behind a prop", | ||
| "type": "minor" | ||
| } | ||
| ], | ||
| "packageName": "office-ui-fabric-react", | ||
| "email": "[email protected]" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -175,10 +175,15 @@ export class BasePicker<T, P extends IBasePickerProps<T>> extends BaseComponent< | |
| } = this.props; | ||
|
|
||
| const currentIndex = this.suggestionStore.currentIndex; | ||
| const selectedSuggestion = currentIndex > -1 ? this.suggestionStore.getSuggestionAtIndex(this.suggestionStore.currentIndex) : undefined; | ||
| const selectedSuggestionAlert = selectedSuggestion ? selectedSuggestion.ariaLabel : undefined; | ||
| const activeDescendant = currentIndex > -1 ? 'sug-' + currentIndex : undefined; | ||
|
|
||
| let selectedSuggestionAlert = undefined; | ||
| if (this.props.enableSelectedSuggestionAlert) { | ||
| const selectedSuggestion = currentIndex > -1 ? this.suggestionStore.getSuggestionAtIndex(this.suggestionStore.currentIndex) : undefined; | ||
| const selectedSuggestionAlertText = selectedSuggestion ? selectedSuggestion.ariaLabel : undefined; | ||
| selectedSuggestionAlert = (<div className={ styles.screenReaderOnly } role='alert' id='selected-suggestion-alert' aria-live='assertive'>{ selectedSuggestionAlertText } </div>); | ||
|
Contributor
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. Why is this element assertive while the one below is polite, shouldn't they be the same? (Polite seems like the correct level to use here)
Author
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. For IE. The only reason this alert exists at all is for IE, and in traditional IE fashion, it does not read unless it is set to "assertive". Definitely agree that polite seems like the correct level here, but since this alert was created so it would work in IE, we need it to be assertive.
Contributor
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. Okay, in that case should the live region below also use assertive? |
||
| } | ||
|
|
||
| return ( | ||
| <div | ||
| ref={ this.root } | ||
|
|
@@ -192,7 +197,7 @@ export class BasePicker<T, P extends IBasePickerProps<T>> extends BaseComponent< | |
| direction={ FocusZoneDirection.bidirectional } | ||
| isInnerZoneKeystroke={ this._isFocusZoneInnerKeystroke } | ||
| > | ||
| <div className={ styles.screenReaderOnly } role='alert' id='selected-suggestion-alert' aria-live='assertive'>{ selectedSuggestionAlert } </div> | ||
| { selectedSuggestionAlert } | ||
| <SelectionZone selection={ this.selection } selectionMode={ SelectionMode.multiple }> | ||
| <div className={ css('ms-BasePicker-text', styles.pickerText, this.state.isFocused && styles.inputFocused) } role={ 'list' }> | ||
| { this.renderItems() } | ||
|
|
||
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.
More of just a general point, we should really have a screen reader component or something that does this and handles all those attributes so we can have them standardized. @cliffkoh or @dzearing what do you think about that?